XBMC crashes, when python plugin starts thread
#1
Hi,

I am writing python plugin (MPD client) for drahma (compiled xbmc from trunk) and I have problems with starting thread (I guess)

My plugin is XMLWindow based and in its OnInit() method it starts a thread, the thread is cleanly recycled when window is closed.

My problem is weird:

1. when I run (just open it, do some little stuff and close then) my plugin (several times) it works great.
2. next when I browse through XBMC, especially System->Addons->enabled addonds, but in common showing other dialogs/windows
After that, when i go back and try to start my plugin, xbmc crashes without any message. XBMC dies exactly when my plugin is on line thread.start()

Is there any recommended way, how to treat with threads in plugins?
I would like to avoid threads, but it seems to be impossible for me, since I need to poll incomming changes from MPD server.

Thanks
Reply
#2
Hi lzoubek,

I had a similar problem with threading in pythons. I solved this by writing my own python module in C/C++ which did all the threading stuff. Then this module called couple of callbacks in the script. The script is then running as a window or dialog (doModal()).

I hope this helps.
Reply
#3
Hey. I'm working on some code that is targeted at the same area. Is it possible that I can get both your implementations to use as a reference?

Thanks
Reply
#4
I already have explanation for my threading issue. http://trac.xbmc.org/ticket/9892

So the problem was in the way how I built xbmc. Now when using internal python 2.4 threads run ok
Reply
#5
Sorry, for some reasons I do not receive mails when on new posts in a thread.

The C++ implementation is actually pretty easy. One can find tons of tutorials in the internet how to write own python module. A python module is just a shared library which can be loaded in python by "import mymodule". Thats it. Then any function registered within the module can be accessed as "mymodule.doMagic()".
Reply

Logout Mark Read Team Forum Stats Members Help
XBMC crashes, when python plugin starts thread0