diff options
author | Jon Trowbridge <trow@ximian.com> | 2003-03-04 16:47:03 +0000 |
---|---|---|
committer | Jon Trowbridge <trow@src.gnome.org> | 2003-03-04 16:47:03 +0000 |
commit | 4eb87378fc6deceea26ef28582b5a3028815200e (patch) | |
tree | a5b1bfef759cce963d0184c108e9d9cac4077850 /gtk/gtkmodule.c | |
parent | 511c8a768b3de36bdab05448ffdefd6ef2d43172 (diff) | |
download | pygtk-4eb87378fc6deceea26ef28582b5a3028815200e.tar.gz |
Block threads while we make our Py* calls. This prevents a 'no current
2003-03-04 Jon Trowbridge <trow@ximian.com>
* gtk/gtkmodule.c (python_do_pending_calls): Block threads while
we make our Py* calls. This prevents a 'no current thread' error
if you try to kill a program by typing ctrl-c in the console it
was launched from.
Diffstat (limited to 'gtk/gtkmodule.c')
-rw-r--r-- | gtk/gtkmodule.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gtk/gtkmodule.c b/gtk/gtkmodule.c index ba77dda3..8651d946 100644 --- a/gtk/gtkmodule.c +++ b/gtk/gtkmodule.c @@ -38,10 +38,17 @@ sink_gtkobject(GObject *object) static gboolean python_do_pending_calls(gpointer data) { + gboolean quit = FALSE; + + pyg_block_threads(); if (PyErr_CheckSignals() == -1) { PyErr_SetNone(PyExc_KeyboardInterrupt); - gtk_main_quit(); + quit = TRUE; } + pyg_unblock_threads(); + + if (quit) + gtk_main_quit(); return TRUE; } |