[gthumb/gthumb-2-12] don't try to save the state if there is no window mapped



commit 4d6ba3b948a258f15ccf121e40fe164485731c6b
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Wed Feb 23 00:03:06 2011 +0100

    don't try to save the state if there is no window mapped

 gthumb/gth-browser.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 06d10c3..83ad4b8 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -2202,12 +2202,16 @@ _gth_browser_real_set_current_page (GthWindow *window,
 	_gth_browser_hide_infobar (browser);
 
 	if (prev_page == GTH_BROWSER_PAGE_BROWSER) {
-		GdkWindowState state;
+		GdkWindow *gdk_win;
 
-		state = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (browser)));
-		if ((state & GDK_WINDOW_STATE_MAXIMIZED) == 0) { /* ! maximized */
-			gtk_window_get_size (GTK_WINDOW (window), &width, &height);
-			gth_window_save_page_size (GTH_WINDOW (window), prev_page, width, height);
+		gdk_win = gtk_widget_get_window (GTK_WIDGET (browser));
+		if (gdk_win != NULL) {
+			GdkWindowState state = gdk_window_get_state (gdk_win);
+
+			if ((state & GDK_WINDOW_STATE_MAXIMIZED) == 0) { /* ! maximized */
+				gtk_window_get_size (GTK_WINDOW (browser), &width, &height);
+				gth_window_save_page_size (GTH_WINDOW (browser), prev_page, width, height);
+			}
 		}
 	}
 



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