From 0677bcd3e3207bf8a0c6a0239a879818f65da15c Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Tue, 29 Apr 2003 09:23:05 +0000 Subject: Check if there are states before saving, fix a crash closing the nautilus 2003-04-29 Marco Pesenti Gritti * lib/ephy-state.c: (ephy_states_save) Check if there are states before saving, fix a crash closing the nautilus view. --- ChangeLog | 7 +++++++ lib/ephy-state.c | 10 ++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1433a8842..4d48a6a78 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-04-29 Marco Pesenti Gritti + + * lib/ephy-state.c: (ephy_states_save) + + Check if there are states before saving, fix a crash + closing the nautilus view. + 2003-04-29 Marco Pesenti Gritti * data/art/Makefile.am: diff --git a/lib/ephy-state.c b/lib/ephy-state.c index 44d85909a..746554562 100644 --- a/lib/ephy-state.c +++ b/lib/ephy-state.c @@ -41,7 +41,7 @@ enum EPHY_NODE_STATE_PROP_POSITION_Y = 7 }; -static EphyNode *states; +static EphyNode *states = NULL; static void ephy_states_load (void) @@ -83,6 +83,8 @@ ephy_states_save (void) int i; char *xml_file; + if (states == NULL) return; + xml_file = g_build_filename (ephy_dot_dir (), STATES_FILE, NULL); @@ -191,7 +193,7 @@ ephy_state_window_set_position (GtkWidget *window, EphyNode *node) if ((x >= screen_width) || (y >= screen_height)) { x = y = WINDOW_POSITION_UNSET; - } + } /* If the window has a saved position set it, otherwise let the WM do it */ if ((x != WINDOW_POSITION_UNSET) && (y != WINDOW_POSITION_UNSET)) @@ -323,13 +325,13 @@ ephy_state_add_window (GtkWidget *window, /* Metacity and presumably any other sane wm won't let * you drag the titlebar of a window off the screen, so * we set the inital cordinate to an impossible value (-1,-1) - */ + */ g_value_init (&value, G_TYPE_INT); g_value_set_int (&value, WINDOW_POSITION_UNSET); ephy_node_set_property (node, EPHY_NODE_STATE_PROP_POSITION_X, &value); g_value_unset (&value); - + g_value_init (&value, G_TYPE_INT); g_value_set_int (&value, WINDOW_POSITION_UNSET); ephy_node_set_property (node, EPHY_NODE_STATE_PROP_POSITION_Y, -- cgit v1.2.3