2006-09-28 [colin] 2.5.2cvs17
authorColin Leroy <colin@colino.net>
Thu, 28 Sep 2006 17:33:47 +0000 (17:33 +0000)
committerColin Leroy <colin@colino.net>
Thu, 28 Sep 2006 17:33:47 +0000 (17:33 +0000)
* src/main.c
More guards for the session management

ChangeLog
PATCHSETS
configure.ac
src/main.c

index 3825a47..0656983 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-09-28 [colin]     2.5.2cvs17
+
+       * src/main.c
+               More guards for the session management
+
 2006-09-28 [colin]     2.5.2cvs16
 
        * src/folderview.c
index c6455ba..88d169d 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.155.2.42 -r 1.155.2.43 src/Makefile.am;  ) > 2.5.2cvs14.patchset
 ( cvs diff -u -r 1.60.2.66 -r 1.60.2.67 src/addressbook.c;  ) > 2.5.2cvs15.patchset
 ( cvs diff -u -r 1.207.2.123 -r 1.207.2.124 src/folderview.c;  cvs diff -u -r 1.1.4.32 -r 1.1.4.33 src/gtk/gtksctree.c;  cvs diff -u -r 1.1.4.8 -r 1.1.4.9 src/gtk/gtksctree.h;  ) > 2.5.2cvs16.patchset
+( cvs diff -u -r 1.115.2.105 -r 1.115.2.106 src/main.c;  ) > 2.5.2cvs17.patchset
index 5d6fd73..f8f8518 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=5
 MICRO_VERSION=2
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=16
+EXTRA_VERSION=17
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index fc29e96..0e4db04 100644 (file)
@@ -289,7 +289,7 @@ static gboolean migrate_old_config(const gchar *old_cfg_dir, const gchar *new_cf
 
 #ifdef HAVE_LIBSM
 static void
-sc_client_set_value (MainWindow *client,
+sc_client_set_value (MainWindow *mainwin,
                  gchar       *name,
                  char        *type,
                  int          num_vals,
@@ -304,7 +304,8 @@ sc_client_set_value (MainWindow *client,
        prop.vals = vals;
 
        proplist[0]= &prop;
-       SmcSetProperties ((SmcConn) client->smc_conn, 1, proplist);
+       if (mainwin->smc_conn)
+               SmcSetProperties ((SmcConn) mainwin->smc_conn, 1, proplist);
 }
 
 static void sc_die_callback (SmcConn smc_conn, SmPointer client_data)
@@ -319,7 +320,8 @@ static void sc_save_complete_callback(SmcConn smc_conn, SmPointer client_data)
 static void sc_shutdown_cancelled_callback (SmcConn smc_conn, SmPointer client_data)
 {
        MainWindow *mainwin = (MainWindow *)client_data;
-       SmcSaveYourselfDone ((SmcConn) mainwin->smc_conn, TRUE);
+       if (mainwin->smc_conn)
+               SmcSaveYourselfDone ((SmcConn) mainwin->smc_conn, TRUE);
 }
 
 static void sc_save_yourself_callback (SmcConn   smc_conn,
@@ -330,7 +332,8 @@ static void sc_save_yourself_callback (SmcConn   smc_conn,
                               gboolean  fast) {
 
        MainWindow *mainwin = (MainWindow *)client_data;
-       SmcSaveYourselfDone ((SmcConn) mainwin->smc_conn, TRUE);
+       if (mainwin->smc_conn)
+               SmcSaveYourselfDone ((SmcConn) mainwin->smc_conn, TRUE);
 }
 
 static IceIOErrorHandler sc_ice_installed_handler;
@@ -425,7 +428,7 @@ static void sc_session_manager_connect(MainWindow *mainwin)
        if (g_getenv ("SESSION_MANAGER")) {
                gchar error_string_ret[256] = "";
 
-               mainwin->smc_conn= (gpointer)
+               mainwin->smc_conn = (gpointer)
                        SmcOpenConnection (NULL, mainwin,
                                SmProtoMajor, SmProtoMinor,
                                SmcSaveYourselfProcMask | SmcDieProcMask |
@@ -435,7 +438,7 @@ static void sc_session_manager_connect(MainWindow *mainwin)
                                NULL, &client_id,
                                256, error_string_ret);
 
-               if (error_string_ret[0])
+               if (error_string_ret[0] || mainwin->smc_conn == NULL)
                        g_warning ("While connecting to session manager:\n%s.",
                                error_string_ret);
                else {
@@ -821,9 +824,6 @@ static gboolean sc_exiting = FALSE;
 static void exit_sylpheed(MainWindow *mainwin)
 {
        gchar *filename;
-#ifdef HAVE_LIBSM
-       SmcConn smc_conn = mainwin->smc_conn;
-#endif
 
        sc_exiting = TRUE;
 
@@ -871,6 +871,12 @@ static void exit_sylpheed(MainWindow *mainwin)
 
        lock_socket_remove();
 
+#ifdef HAVE_LIBSM
+       if (mainwin->smc_conn)
+               SmcCloseConnection ((SmcConn)mainwin->smc_conn, 0, NULL);
+       mainwin->smc_conn = NULL;
+#endif
+
        main_window_destroy_all();
        
        plugin_unload_all("GTK2");
@@ -898,9 +904,6 @@ static void exit_sylpheed(MainWindow *mainwin)
        gtkaspell_checkers_quit();
 #endif
        sylpheed_done();
-#ifdef HAVE_LIBSM
-       SmcCloseConnection (smc_conn, 0, NULL);
-#endif
 }
 
 static void parse_cmd_opt(int argc, char *argv[])