[epiphany/mcatanzaro/#1043] session: keep window alive when parsing session



commit 98d18b172ce72035821065a9a27a67fbe551a213
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Fri Jan 10 14:22:24 2020 -0600

    session: keep window alive when parsing session
    
    We can crash here if the window is destroyed immediately after starting
    Epiphany, before we finish loading the session.
    
    Note that gtk_window_new() doesn't return a reference; that's held by
    GTK. So we have to keep it alive here until we're done with it.
    
    Fixes #1043

 src/ephy-session.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/src/ephy-session.c b/src/ephy-session.c
index c5c05597b..081750b0c 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -1099,6 +1099,8 @@ static void
 session_parser_context_free (SessionParserContext *context)
 {
   g_object_unref (context->session);
+  if (context->window)
+    g_object_unref (context->window);
 
   g_free (context);
 }
@@ -1111,7 +1113,9 @@ session_parse_window (SessionParserContext  *context,
   GdkRectangle geometry = { -1, -1, 0, 0 };
   guint i;
 
+  g_assert (!context->window);
   context->window = ephy_window_new ();
+  g_object_ref (context->window);
 
   for (i = 0; names[i]; i++) {
     gulong int_value;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]