From: John Darrington Date: Tue, 14 Apr 2009 11:09:24 +0000 (+0800) Subject: Make the gui more thread safe X-Git-Tag: sav-api~661 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=37329c68f3f4c77ee2baa88a70e9ba6701e4008f;p=pspp Make the gui more thread safe --- diff --git a/src/ui/gui/message-dialog.c b/src/ui/gui/message-dialog.c index 866f8c6d91..81c08f8cd9 100644 --- a/src/ui/gui/message-dialog.c +++ b/src/ui/gui/message-dialog.c @@ -192,6 +192,8 @@ popup_messages (gpointer unused UNUSED) struct string msg = DS_EMPTY_INITIALIZER; int message_cnt; + gdk_threads_enter (); + /* Set up the dialog. */ if (message_xml == NULL || message_dialog == NULL) goto use_fallback; @@ -204,6 +206,7 @@ popup_messages (gpointer unused UNUSED) { ds_destroy (&lead); ds_destroy (&msg); + gdk_threads_leave (); return TRUE; } @@ -266,6 +269,7 @@ popup_messages (gpointer unused UNUSED) ds_destroy (&lead); ds_destroy (&msg); + gdk_threads_leave (); return FALSE; use_fallback: @@ -274,6 +278,7 @@ use_fallback: fputs (ds_cstr (&msg), stderr); ds_destroy (&lead); ds_destroy (&msg); + gdk_threads_leave (); return FALSE; } diff --git a/src/ui/gui/psppire-dialog.c b/src/ui/gui/psppire-dialog.c index dbe4612f02..cea5134630 100644 --- a/src/ui/gui/psppire-dialog.c +++ b/src/ui/gui/psppire-dialog.c @@ -513,7 +513,9 @@ psppire_dialog_run (PsppireDialog *dialog) g_signal_emit (dialog, signals [DIALOG_REFRESH], 0); + gdk_threads_leave (); g_main_loop_run (dialog->loop); + gdk_threads_enter (); g_main_loop_unref (dialog->loop);