From: Ben Pfaff Date: Mon, 9 May 2011 04:24:17 +0000 (-0700) Subject: psppire-sheet: Avoid CRITICAL unselecting range before window created. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp;a=commitdiff_plain;h=b6bdcd272fc808fe886c4873ec1ea3179ca1117c psppire-sheet: Avoid CRITICAL unselecting range before window created. Without this change, File|Open that opens a new datasheet yields: Gdk-CRITICAL **: gdk_window_invalidate_rect_full: assertion `GDK_IS_WINDOW (window)' failed I'm not 100% certain that this is the correct fix--perhaps the client is at fault for calling this function before a window exists?--but it does avoid the message. --- diff --git a/lib/gtk-contrib/psppire-sheet.c b/lib/gtk-contrib/psppire-sheet.c index 760b0fd12a..ecadf742cb 100644 --- a/lib/gtk-contrib/psppire-sheet.c +++ b/lib/gtk-contrib/psppire-sheet.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2006, 2008, 2009 Free Software Foundation + Copyright (C) 2006, 2008, 2009, 2011 Free Software Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -2721,13 +2721,17 @@ psppire_sheet_select_range (PsppireSheet *sheet, const PsppireSheetRange *range) void psppire_sheet_unselect_range (PsppireSheet *sheet) { - GdkRectangle area; sheet->select_status = PSPPIRE_SHEET_NORMAL; - rectangle_from_range (sheet, &sheet->range, &area); - area.x++; - area.y++; - gdk_window_invalidate_rect (sheet->sheet_window, &area, FALSE); + if (sheet->sheet_window != NULL) + { + GdkRectangle area; + + rectangle_from_range (sheet, &sheet->range, &area); + area.x++; + area.y++; + gdk_window_invalidate_rect (sheet->sheet_window, &area, FALSE); + } g_signal_emit (sheet, sheet_signals [SELECT_COLUMN], 0, -1); g_signal_emit (sheet, sheet_signals [SELECT_ROW], 0, -1);