Seg fault when launching my module through my C/C++ application

Maxime Boure mboure at ubiquiet.com
Tue Apr 13 09:59:48 CEST 2010


Hello everyone,

I made a small python module to command NetworkManager and get some signals
from it.

My script works well alone, but when I launch it from my C/C++ program it
crashes at a certain function (here iface.GetDevices). Here is the function
that crashes and next my gdb print

*def get_device_path_by_type(type):*
*  proxy = bus.get_object('org.freedesktop.NetworkManager',
'/org/freedesktop/NetworkManager')*
*  iface = dbus.Interface(proxy,
dbus_interface='org.freedesktop.NetworkManager')*
*  print "iface : %s" % iface *
*  for d in iface.GetDevices():*
*    print "--> after getdevices"*
*    proxy = bus.get_object('org.freedesktop.NetworkManager', d)*
*    iface = dbus.Interface(proxy,
dbus_interface='org.freedesktop.DBus.Properties')*
*    devtype = iface.Get('org.freedesktop.NetworkManager.Device',
'DeviceType')*
*    print "type : %d" % devtype*
*    if devtype == type:*
*      print "%s" % d*
*      return d*
*  print "return none"*
*  return None*
*- - - - - - - - - - - - -  - - - - - - - - - - - -  - - - - - - - - - - -
-  - - - - - - - - - - - -  - - - - - - - - - - - -  - - - - - - - - - - -
-  - - - - - - - - - - - - *
*
iface : <Interface <ProxyObject wrapping <dbus._dbus.SystemBus (system) at
0x3fae0d20> :1.0 /org/freedesktop/NetworkManager at 0x3fae2710> implementing
'org.freedesktop.NetworkManager' at 0x3fae27d0>

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x4035a460 (LWP 2214)]
0x3b8af144 in sem_post@@GLIBC_2.4 () from /lib/libpthread.so.0
(gdb) bt
#0  0x3b8af144 in sem_post@@GLIBC_2.4 () from /lib/libpthread.so.0
#1  0x3b2ca9b4 in PyThread_release_lock () from /usr/lib/libpython2.6.so.1.0
#2  0x3b2987c4 in PyEval_ReleaseLock () from /usr/lib/libpython2.6.so.1.0
#3  0x3b2bd518 in PyThreadState_DeleteCurrent ()
   from /usr/lib/libpython2.6.so.1.0
#4  0x3f9bce50 in ?? () from /usr/lib/pyshared/python2.6/_dbus_bindings.so

Just so you know I use other function from that script that works well with
my C/C++ application. Do you have any idea of why there would be a threading
problem ? And why a seg fault ?

Thank you for your inputs

Regards

Maxime

*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100413/ca2fae50/attachment.html>


More information about the Python-list mailing list