From cc9a8c3c85930632cbb363c47d03302e5a848b36 Mon Sep 17 00:00:00 2001 From: dcherepanov Date: Tue, 6 Jul 2010 18:23:09 +0400 Subject: [PATCH] 6966643: GTK FileDialog hangs when user manually closes it Reviewed-by: art --- .../sun/awt/sun_awt_X11_GtkFileDialogPeer.c | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c b/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c index f04436422..0c26096e5 100644 --- a/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c +++ b/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c @@ -42,17 +42,16 @@ static gboolean filenameFilterCallback(const GtkFileFilterInfo * filter_info, gp filename); } -/* - * Class: sun_awt_X11_GtkFileDialogPeer - * Method: quit - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_quit -(JNIEnv * env, jobject jpeer) +static void quit(gboolean isSignalHandler) { if (dialog != NULL) { - fp_gdk_threads_enter(); + // Callbacks from GTK signals are made within the GTK lock + // So, within a signal handler there is no need to call + // gdk_threads_enter() / fp_gdk_threads_leave() + if (!isSignalHandler) { + fp_gdk_threads_enter(); + } fp_gtk_widget_hide (dialog); fp_gtk_widget_destroy (dialog); @@ -60,10 +59,23 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_quit fp_gtk_main_quit (); dialog = NULL; - fp_gdk_threads_leave(); + if (!isSignalHandler) { + fp_gdk_threads_leave(); + } } } +/* + * Class: sun_awt_X11_GtkFileDialogPeer + * Method: quit + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_quit +(JNIEnv * env, jobject jpeer) +{ + quit(FALSE); +} + /** * Convert a GSList to an array of filenames (without the parent folder) */ @@ -147,7 +159,7 @@ static void handle_response(GtkWidget* aDialog, gint responseId, gpointer obj) jfilenames); fp_g_free(current_folder); - Java_sun_awt_X11_GtkFileDialogPeer_quit(NULL, NULL); + quit(TRUE); } /* -- GitLab