[gnome-photos] Fix crash when reading scale factor after window has been destroyed
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] Fix crash when reading scale factor after window has been destroyed
- Date: Mon, 10 Nov 2014 14:15:27 +0000 (UTC)
commit c250ff800d218a81538c22e29732892e4d4e66d8
Author: Debarshi Ray <debarshir gnome org>
Date: Mon Nov 10 15:07:36 2014 +0100
Fix crash when reading scale factor after window 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. I am
uncomfortable making such a change in a stable bug-fix release unless
I can reproduce this scenario to ensure that it does not regress
anything.
https://bugzilla.gnome.org/show_bug.cgi?id=738527
src/photos-application.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index bd6c010..8f0860d 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -1085,7 +1085,7 @@ gint
photos_application_get_scale_factor (PhotosApplication *self)
{
GList *windows;
- gint scale_factor;
+ gint ret_val = 1;
/* We do not use priv->main_window to allow widgets to use this
* method while they are being constructed. The widget hierarchy is
@@ -1093,6 +1093,11 @@ photos_application_get_scale_factor (PhotosApplication *self)
* priv->main_window is NULL.
*/
windows = gtk_application_get_windows (GTK_APPLICATION (self));
- scale_factor = gtk_widget_get_scale_factor (GTK_WIDGET (windows->data));
- return scale_factor;
+ if (windows == NULL)
+ goto out;
+
+ ret_val = gtk_widget_get_scale_factor (GTK_WIDGET (windows->data));
+
+ out:
+ return ret_val;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]