[gtk+] magnifier: gtk_snapshot_finish may return NULL



commit 6652beae65c402d400d54417933508bc8070b44d
Author: Timm Bäder <mail baedert org>
Date:   Wed Jan 10 14:41:29 2018 +0100

    magnifier: gtk_snapshot_finish may return NULL

 gtk/gtkmagnifier.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkmagnifier.c b/gtk/gtkmagnifier.c
index 90f4bcc..7d09b10 100644
--- a/gtk/gtkmagnifier.c
+++ b/gtk/gtkmagnifier.c
@@ -124,12 +124,15 @@ gtk_magnifier_snapshot (GtkWidget   *widget,
   gtk_widget_snapshot (priv->inspected, &inspected_snapshot);
   inspected_node = gtk_snapshot_finish (&inspected_snapshot);
 
-  graphene_matrix_init_identity (&transform);
-  graphene_matrix_scale (&transform, priv->magnification, priv->magnification, 1);
+  if (inspected_node != NULL)
+    {
+      graphene_matrix_init_identity (&transform);
+      graphene_matrix_scale (&transform, priv->magnification, priv->magnification, 1);
 
-  gtk_snapshot_push_transform (snapshot, &transform, "Magnifier transform");
-  gtk_snapshot_append_node (snapshot, inspected_node);
-  gtk_snapshot_pop (snapshot);
+      gtk_snapshot_push_transform (snapshot, &transform, "Magnifier transform");
+      gtk_snapshot_append_node (snapshot, inspected_node);
+      gtk_snapshot_pop (snapshot);
+    }
 
 
   g_signal_handler_unblock (priv->inspected, priv->draw_handler);


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