[epiphany] session: Fix EPHY_PREFS_RESTORE_SESSION_POLICY_CRASHED



commit 04e7811c32ba8a2c980a77aac1316b77f0969057
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Sat Mar 5 14:26:55 2016 -0600

    session: Fix EPHY_PREFS_RESTORE_SESSION_POLICY_CRASHED
    
    We accidentally broke this when adding support for
    WebKitWebViewSessionState. Currently
    EPHY_PREFS_RESTORE_SESSION_POLICY_CRASHED is treated exactly the same as
    EPHY_PREFS_RESTORE_SESSION_POLICY_ALWAYS. The simplest way to fix this
    is to consider that, if we've made it to ephy_session_close(), then we
    have not crashed, that's a good place to delete the session file.
    Otherwise, that session file had better be saved so it can be loaded if
    we crash, ephy_session_close() is the best place to handle this.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=762906

 src/ephy-session.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/src/ephy-session.c b/src/ephy-session.c
index f2bf88c..a041930 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -534,6 +534,8 @@ ephy_session_class_init (EphySessionClass *class)
 void
 ephy_session_close (EphySession *session)
 {
+       EphyPrefsRestoreSessionPolicy policy;
+
        g_return_if_fail (EPHY_IS_SESSION (session));
 
        LOG ("ephy_session_close");
@@ -546,8 +548,19 @@ ephy_session_close (EphySession *session)
                g_source_remove (session->save_source_id);
                session->save_source_id = 0;
        }
+
        session->closing = TRUE;
-       ephy_session_save_idle_cb (session);
+
+       policy = g_settings_get_enum (EPHY_SETTINGS_MAIN, EPHY_PREFS_RESTORE_SESSION_POLICY);
+       if (policy == EPHY_PREFS_RESTORE_SESSION_POLICY_ALWAYS)
+       {
+               ephy_session_save_idle_cb (session);
+       }
+       else
+       {
+               session_delete (session);
+       }
+
        session->dont_save = TRUE;
 }
 


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