Re: Deadlock problem when calling messagebox function with idle_add

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

 



Okay I found a workaround:

def helper():
    gtk.gdk.threads_enter()
    putMessageBox(...)
    gtk.gdk.threads_leave()
gobject.idle_add(helper)

But why do I have to do that? Note that I call the above from the main thread, no multithreading involved. Please can somebody explain why this is necessary?


Andreas Sommer wrote:
Hi,

I have a function putMessageBox which shows a message box dialog like this (it's Python but I think it's not specific to that language):

...
dialog.run()
dialog.hide()
...


Calling the function normally from somewhere in the main thread works, but when I execute it with

def helper():
    putMessageBox(...)
gobject.idle_add(helper)


it deadlocks as soon as I press the OK button on the dialog. The dialog does not disappear, the buttons stays pressed and the complete application is stuck. Same with timeout_add, of course.

If I replace run() by show(), which of course shows the dialog only for some nanoseconds, the deadlock does not occur.

Do you know what the problem is??

_______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux