[evolution/wip/webkit2] Enhance workaround for bug 737949
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] Enhance workaround for bug 737949
- Date: Thu, 3 Mar 2016 13:43:23 +0000 (UTC)
commit 66f7be504f22ad4d89f3260b2604ec59e88c21e2
Author: Milan Crha <mcrha redhat com>
Date: Fri Jan 15 11:46:31 2016 +0100
Enhance workaround for bug 737949
Not precisely an issue of the evolution, as it uses to be with workarounds,
but better to catch it here, when it's possible. This avoids crash of
the evolution on quit of the second instance and some critical warnings,
while still not leaking the EShell instance.
shell/e-shell.c | 36 ++++++++++++++++++++++++++++++++++++
shell/e-shell.h | 1 +
shell/main.c | 6 ++++--
3 files changed, 41 insertions(+), 2 deletions(-)
---
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 96e7c2d..312ba68 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -87,6 +87,7 @@ struct _EShellPrivate {
guint quit_cancelled : 1;
guint ready_to_quit : 1;
guint safe_mode : 1;
+ guint requires_shutdown : 1;
};
enum {
@@ -1485,6 +1486,15 @@ shell_constructed (GObject *object)
static void
shell_startup (GApplication *application)
{
+ EShell *shell;
+
+ g_return_if_fail (E_IS_SHELL (application));
+
+ shell = E_SHELL (application);
+ g_warn_if_fail (!shell->priv->requires_shutdown);
+
+ shell->priv->requires_shutdown = TRUE;
+
e_file_lock_create ();
/* Destroy the lock file when the EShell is finalized
@@ -1501,6 +1511,23 @@ shell_startup (GApplication *application)
}
static void
+shell_shutdown (GApplication *application)
+{
+ EShell *shell;
+
+ g_return_if_fail (E_IS_SHELL (application));
+
+ shell = E_SHELL (application);
+
+ g_warn_if_fail (shell->priv->requires_shutdown);
+
+ shell->priv->requires_shutdown = FALSE;
+
+ /* Chain up to parent's method. */
+ G_APPLICATION_CLASS (e_shell_parent_class)->shutdown (application);
+}
+
+static void
shell_activate (GApplication *application)
{
GList *list;
@@ -1633,6 +1660,7 @@ e_shell_class_init (EShellClass *class)
application_class = G_APPLICATION_CLASS (class);
application_class->startup = shell_startup;
+ application_class->shutdown = shell_shutdown;
application_class->activate = shell_activate;
gtk_application_class = GTK_APPLICATION_CLASS (class);
@@ -1942,6 +1970,7 @@ e_shell_init (EShell *shell)
shell->priv->backends_by_name = backends_by_name;
shell->priv->backends_by_scheme = backends_by_scheme;
shell->priv->safe_mode = e_file_lock_exists ();
+ shell->priv->requires_shutdown = FALSE;
/* Add our icon directory to the theme's search path
* here instead of in main() so Anjal picks it up. */
@@ -2697,3 +2726,10 @@ e_shell_cancel_quit (EShell *shell)
g_signal_stop_emission (shell, signals[QUIT_REQUESTED], 0);
}
+gboolean
+e_shell_requires_shutdown (EShell *shell)
+{
+ g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
+
+ return shell->priv->requires_shutdown;
+}
diff --git a/shell/e-shell.h b/shell/e-shell.h
index 1d336e2..510d627 100644
--- a/shell/e-shell.h
+++ b/shell/e-shell.h
@@ -146,6 +146,7 @@ void e_shell_event (EShell *shell,
gboolean e_shell_quit (EShell *shell,
EShellQuitReason reason);
void e_shell_cancel_quit (EShell *shell);
+gboolean e_shell_requires_shutdown (EShell *shell);
G_END_DECLS
diff --git a/shell/main.c b/shell/main.c
index a603996..46dcd23 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -655,8 +655,10 @@ main (gint argc,
gtk_main ();
exit:
- /* Workaround https://bugzilla.gnome.org/show_bug.cgi?id=737949 */
- g_signal_emit_by_name (shell, "shutdown");
+ if (e_shell_requires_shutdown (shell)) {
+ /* Workaround https://bugzilla.gnome.org/show_bug.cgi?id=737949 */
+ g_signal_emit_by_name (shell, "shutdown");
+ }
/* Drop what should be the last reference to the shell.
* That will cause e_shell_get_default() to henceforth
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]