[gtk+/wip/baedert/gtkimageview: 3/3] snapshot: Avoid a double-free



commit 1ef9f2eacbbc379622dc54f7dac8bc4031f6650a
Author: Timm Bäder <mail baedert org>
Date:   Tue Feb 14 13:23:08 2017 +0100

    snapshot: Avoid a double-free
    
    We can't pass the same string to two different snapshot states since
    removing one of them will free the passed string, so just create another
    one for the second state.

 gtk/gtksnapshot.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c
index 7b8bfdd..52d43bf 100644
--- a/gtk/gtksnapshot.c
+++ b/gtk/gtksnapshot.c
@@ -741,6 +741,9 @@ gtk_snapshot_push_blend (GtkSnapshot  *snapshot,
   state->data.blend.blend_mode = blend_mode;
   state->data.blend.bottom_node = NULL;
 
+  if (str)
+    str = g_strdup (str);
+
   state = gtk_snapshot_state_new (state,
                                   str,
                                   state->clip_region,
@@ -862,6 +865,9 @@ gtk_snapshot_push_cross_fade (GtkSnapshot *snapshot,
   state->data.cross_fade.progress = progress;
   state->data.cross_fade.start_node = NULL;
 
+  if (str)
+    str = g_strdup (str);
+
   state = gtk_snapshot_state_new (state,
                                   str,
                                   state->clip_region,


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