Re: [Rhythmbox-devel] Rhythmbox crashes when using threads and network sockets



2010/3/22 Samuel Skånberg <samuel_skanberg yahoo se>
>
> Hi,
> I have started to develop a command line interface to rhythmbox called rhythmcurse: http://github.com/sameltvom/rhythmcurse.
> The plugin spawns a thread that listens for network connection. If a connection is being made by a client (the actual cli application) another thread is being spawned. Then that thread reads commands from the client via a network socket and depending on the commands the plugin either plays, pauses, skips to next song or plays the previous.
> This works! However... it doesn't work all that good. Rhythmbox crashes after some commands have been issued and I don't know why. I read something about threads and that I shouldn't use them. I'm confident that a lot of problems can be solved without threads but I have no idea how to do that with my plugin.
> If I run my cli app that connects to the plugin and issue "play" and then "pause" a couple of times, rhythmbox crashes and segfaults.
> Any ideas why or what I could do instead?

At a glance, it seems you're calling the shell player methods on your
plugin's thread, without holding the gdk lock. This won't work. You
need to use an idle handler to perform these actions on the main
thread. You can see some examples of this in the Loader module.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]