summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLogan Rathbone <poprocks@gmail.com>2023-05-08 13:36:51 -0400
committerLogan Rathbone <poprocks@gmail.com>2023-05-08 13:36:51 -0400
commitaa4b8c159f157dfe2d7ef397238c3873ad7050ae (patch)
treee45aa6d1b4b4aedd5ebcf039a63b3bd9cd9d80bf
parent93d4c88cea5167cc6d2bed8b85b7931399068d59 (diff)
downloadzenity-aa4b8c159f157dfe2d7ef397238c3873ad7050ae.tar.gz
util: Ignore superfluous quit requests
This should prevent potential race conditions with STDIN handling.
-rw-r--r--src/util.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index 85847df..ae3067c 100644
--- a/src/util.c
+++ b/src/util.c
@@ -454,6 +454,14 @@ zenity_util_gapp_main (GtkWindow *window)
void
zenity_util_gapp_quit (GtkWindow *window, ZenityData *data)
{
+ static gboolean quit_requested = FALSE;
+
+ if (quit_requested)
+ {
+ g_debug ("%s: Quit request already pending. Ignoring superfluous quit request.", __func__);
+ return;
+ }
+
/* This is a bit hack-ish, but GApplication doesn't really allow for
* customized exit statuses within that API.
*/
@@ -464,6 +472,8 @@ zenity_util_gapp_quit (GtkWindow *window, ZenityData *data)
gtk_window_destroy (window);
else
g_application_release (g_application_get_default ());
+
+ quit_requested = TRUE;
}
int