[gnome-photos/gnome-3-14] Fix crash when trying to use window after it has been destroyed



commit 16a3a9c478a94925f8fa6252e49017df855fff2a
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Feb 23 16:36:43 2015 +0100

    Fix crash when trying to use window after it has been destroyed
    
    Ideally we should cancel all pending operations when the main window
    has been destroyed, but that will require a more intrusive change.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=738527

 src/photos-base-item.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 3f0d575..441f144 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -1,7 +1,7 @@
 /*
  * Photos - access, organize and share your photos on GNOME
  * Copyright © 2014 Pranav Kant
- * Copyright © 2012, 2013, 2014 Red Hat, Inc.
+ * Copyright © 2012, 2013, 2014, 2015 Red Hat, Inc.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -144,7 +144,7 @@ photos_base_item_check_effects_and_update_info (PhotosBaseItem *self)
   GList *windows;
   GdkPixbuf *emblemed_pixbuf = NULL;
   GdkPixbuf *thumbnailed_pixbuf = NULL;
-  GdkWindow *window;
+  GdkWindow *window = NULL;
   gint scale;
 
   if (priv->original_icon == NULL)
@@ -230,7 +230,9 @@ photos_base_item_check_effects_and_update_info (PhotosBaseItem *self)
   app = g_application_get_default ();
   scale = photos_application_get_scale_factor (PHOTOS_APPLICATION (app));
   windows = gtk_application_get_windows (GTK_APPLICATION (app));
-  window = gtk_widget_get_window (GTK_WIDGET (windows->data));
+  if (windows != NULL)
+    window = gtk_widget_get_window (GTK_WIDGET (windows->data));
+
   priv->surface = gdk_cairo_surface_create_from_pixbuf (thumbnailed_pixbuf, scale, window);
 
   g_signal_emit (self, signals[INFO_UPDATED], 0);


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