Hello everyone,<div><br></div><div>I made a small python module to command NetworkManager and get some signals from it.</div><div><br></div><div>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 </div>
<div><br></div><div><div><div><i>def get_device_path_by_type(type):</i></div><div><i>  proxy = bus.get_object('org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManager')</i></div><div><i>  iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManager')</i></div>
<div><i>  print "iface : %s" % iface </i></div><div><i>  for d in<span class="Apple-style-span" style="font-size: large;"><font class="Apple-style-span" color="#FF0000"> iface.GetDevices()</font></span>:</i></div>
<div><i>    print "--> after getdevices"</i></div><div><i>    proxy = bus.get_object('org.freedesktop.NetworkManager', d)</i></div><div><i>    iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.DBus.Properties')</i></div>
<div><i>    devtype = iface.Get('org.freedesktop.NetworkManager.Device', 'DeviceType')</i></div><div><i>    print "type : %d" % devtype</i></div><div><i>    if devtype == type:</i></div><div><i>      print "%s" % d</i></div>
<div><i>      return d</i></div><div><i>  print "return none"</i></div><div><i>  return None</i></div></div></div><div><i>- - - - - - - - - - - - - <span class="Apple-style-span" style="font-style: normal; "><i> - - - - - - - - - - - - <span class="Apple-style-span" style="font-style: normal; "><i> - - - - - - - - - - - - <span class="Apple-style-span" style="font-style: normal; "><i> - - - - - - - - - - - - <span class="Apple-style-span" style="font-style: normal; "><i> - - - - - - - - - - - - <span class="Apple-style-span" style="font-style: normal; "><i> - - - - - - - - - - - - <span class="Apple-style-span" style="font-style: normal; "><i> - - - - - - - - - - - - </i></span></i></span></i></span></i></span></i></span></i></span></i></div>
<meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>
<i><div>iface : <Interface <ProxyObject wrapping <dbus._dbus.SystemBus (system) at 0x3fae0d20> :1.0 /org/freedesktop/NetworkManager at 0x3fae2710> implementing 'org.freedesktop.NetworkManager' at 0x3fae27d0></div>
<div><br></div><div>Program received signal SIGSEGV, Segmentation fault.</div><div>[Switching to Thread 0x4035a460 (LWP 2214)]</div><div>0x3b8af144 in sem_post@@GLIBC_2.4 () from /lib/libpthread.so.0</div><div>(gdb) bt</div>
<div>#0  0x3b8af144 in sem_post@@GLIBC_2.4 () from /lib/libpthread.so.0</div><div>#1  0x3b2ca9b4 in PyThread_release_lock () from /usr/lib/libpython2.6.so.1.0</div><div>#2  0x3b2987c4 in PyEval_ReleaseLock () from /usr/lib/libpython2.6.so.1.0</div>
<div>#3  0x3b2bd518 in PyThreadState_DeleteCurrent ()</div><div>   from /usr/lib/libpython2.6.so.1.0</div><div>#4  0x3f9bce50 in ?? () from /usr/lib/pyshared/python2.6/_dbus_bindings.so</div><div><br></div><div><span class="Apple-style-span" style="font-style: normal;">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 ?</span></div>
<div><span class="Apple-style-span" style="font-style: normal;"><br></span></div><div><span class="Apple-style-span" style="font-style: normal;">Thank you for your inputs </span></div><div><span class="Apple-style-span" style="font-style: normal;"><br>
</span></div><div><span class="Apple-style-span" style="font-style: normal;">Regards</span></div><div><span class="Apple-style-span" style="font-style: normal;"><br></span></div><div><span class="Apple-style-span" style="font-style: normal;">Maxime</span></div>
<div><br></div></i></div>