GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Apr 18, 2014 8:04 am

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Multiprocessing and Gtk.main Problem
PostPosted: Fri Mar 09, 2012 5:07 pm 
Offline

Joined: Mon Feb 27, 2012 9:17 pm
Posts: 3
Hello,

I'm writing a small Python debugger plugin for Gedit. It seems to run OK except for when debugging code which is itself Gtk.

The problem goes like this. Within the plugin code, when debugging starts, the debugger is started as a separate process via Python's multiprocessing modue:
Code:
multiprocessing.Process(target = run_dbg)

Inside this process, some script is debugged via Python's bdb module:
Code:
bdb.run('execfile("%s")' % script)

Now suppose the script being debugged contains this code:
Code:
Gtk.main()

Then, when the line is reached, Gedit crashes:
Quote:
[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
gedit: ../../src/xcb_io.c:273: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.

Googling the error yielded many results. While helpful and informative, they seem to consist of suggestions for changes to the code causing the crash (i.e., call Gdk.init_threads() before Gtk.main(), and so forth). Since this is a debugger plugin, I cannot modify GEdit's code, nor the code of the script being debugged (requiring changing code so it can be debuged seems awkward). It seems the root of the problem is that the second, debugger, process, since it was created by the GEdit process, contains some Gtk somewhere. Is there some way to "get rid", in the second, debugger, process, of anything Gtk related? Something like completely_shut_down_anything_gtk() before starting bdb.run()?

Many thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group