Without looking at the code, I can only offer the suggestion to make sure
to call both GLib.threads_init() and Gdk.threads_init() sometime before
Gtk.main() is called. The requirement to call GLib.threads_init() will go
away in 3.10 but in the mean time you need to do this (or if you want
backwards compatibility). See also:
https://bugzilla.gnome.org/show_bug.cgi?id=686914

-Simon


On Mon, Mar 18, 2013 at 7:08 AM, Reg <[email protected]> wrote:

> Hi there, pyhton hackers.
>
> I have run into an issue with a multi-threaded application using PyGObject.
>
> I have a worker thread that at one point needs to wait for the user to
> confirm.
>
> I am doing this with this code:
>
>   def showPrompt(self, msg, expectInput=False):
>     Gdk.threads_enter()
>
>     dialog = Gtk.MessageDialog(self.app.**mainWindow, 0,
> Gtk.MessageType.INFO,
>     Gtk.ButtonsType.OK, "Backup prompt")
>     dialog.format_secondary_text(**msg)
>     dialog.run()
>     dialog.destroy()
>
>     Gdk.threads_leave()
>
> It works fine when I call this method from the main thread where
> Gtk.main() is run.
>
> When I call it from the worker thread I get weird error messages:
>
> (main.py:17834): Gtk-WARNING **: GtkMessageDialog 0x7fbeb0028020: widget
> tried to gtk_widget_get_width inside  GtkWidget ::get_width implementation.
> Should just invoke GTK_WIDGET_GET_CLASS(widget)->**get_width directly
> rather than using gtk_widget_get_width
>
> (main.py:17834): Gtk-WARNING **: GtkBox 0x28f6d50: widget tried to
> gtk_widget_get_width inside  GtkWidget     ::get_width implementation.
> Should just invoke GTK_WIDGET_GET_CLASS(widget)->**get_width directly
> rather than using gtk_widget_get_width
>
> (main.py:17834): Gtk-WARNING **: GtkBox 0x28f6e30: widget tried to
> gtk_widget_get_width inside  GtkWidget     ::get_width implementation.
> Should just invoke GTK_WIDGET_GET_CLASS(widget)->**get_width directly
> rather than using gtk_widget_get_width
>
> (main.py:17834): Gtk-WARNING **: GtkImage 0x2a27dd0: widget tried to
> gtk_widget_get_width inside  GtkWidget     ::get_width implementation.
> Should just invoke GTK_WIDGET_GET_CLASS(widget)->**get_width directly
> rather than using gtk_widget_get_width
> /usr/lib/python2.7/site-**packages/gi/types.py:47: Warning:
> g_hash_table_lookup: assertion `hash_table != NULL' failed
>   return info.invoke(*args, **kwargs)
>
> (main.py:17834): Gtk-WARNING **: Error loading theme icon
> 'dialog-information' for stock: Icon 'dialog-information' not present in
> theme
>
>
> Any tipps here?
> Note that I am using the global lock with threads_enter/leave.
>
>
> I'm greatful for any advice,
>
> Christoph Herzog
> ______________________________**_________________
> python-hackers-list mailing list
> [email protected]
> https://mail.gnome.org/**mailman/listinfo/python-**hackers-list<https://mail.gnome.org/mailman/listinfo/python-hackers-list>
>
_______________________________________________
python-hackers-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/python-hackers-list

Reply via email to