[gnome-builder] app: add spin protection at shutdown
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] app: add spin protection at shutdown
- Date: Thu, 23 Nov 2017 01:26:29 +0000 (UTC)
commit 4b9208850c914e8dd0016c0cfe85d94fa44792d3
Author: Christian Hergert <chergert redhat com>
Date: Wed Nov 22 17:25:32 2017 -0800
app: add spin protection at shutdown
In case we have a plugin that is spinning (looking at you
rustup), ensure that we actually exit in a reasonable amount
of time.
We still need to fix rustup, since it will spin at first use,
but this at least ensures the app will exit.
src/libide/application/ide-application.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/libide/application/ide-application.c b/src/libide/application/ide-application.c
index 9cc9a29..2bc42f0 100644
--- a/src/libide/application/ide-application.c
+++ b/src/libide/application/ide-application.c
@@ -538,6 +538,14 @@ ide_application_open (GApplication *application,
NULL);
}
+static gboolean
+ide_application_force_exit_timeout (gpointer data)
+{
+ g_warning ("Plugin caught spinning, forcing exit immediately");
+ exit (EXIT_FAILURE);
+ return G_SOURCE_REMOVE;
+}
+
static void
ide_application_shutdown (GApplication *application)
{
@@ -565,6 +573,13 @@ ide_application_shutdown (GApplication *application)
}
_ide_battery_monitor_shutdown ();
+
+ /* In case a plugin causes us to spin at shutdown, make sure that we
+ * force exit to avoid spinning in the background.
+ */
+ gdk_threads_add_timeout (3000, /* 3 seconds */
+ ide_application_force_exit_timeout,
+ NULL);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]