[gtk+] gtk-demo: Fix segfault in editable cells demo



commit 6a6af8464be090c23ecee6d6a62c188117da36e1
Author: Benjamin Otte <otte redhat com>
Date:   Tue Nov 22 23:27:40 2011 +0100

    gtk-demo: Fix segfault in editable cells demo
    
    The strings can be freed when edting the description column. This does
    not work with constant strings.

 demos/gtk-demo/editable_cells.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/demos/gtk-demo/editable_cells.c b/demos/gtk-demo/editable_cells.c
index da19b19..debdb8e 100644
--- a/demos/gtk-demo/editable_cells.c
+++ b/demos/gtk-demo/editable_cells.c
@@ -48,27 +48,27 @@ add_items (void)
   g_return_if_fail (articles != NULL);
 
   foo.number = 3;
-  foo.product = "bottles of coke";
+  foo.product = g_strdup ("bottles of coke");
   foo.yummy = 20;
   g_array_append_vals (articles, &foo, 1);
 
   foo.number = 5;
-  foo.product = "packages of noodles";
+  foo.product = g_strdup ("packages of noodles");
   foo.yummy = 50;
   g_array_append_vals (articles, &foo, 1);
 
   foo.number = 2;
-  foo.product = "packages of chocolate chip cookies";
+  foo.product = g_strdup ("packages of chocolate chip cookies");
   foo.yummy = 90;
   g_array_append_vals (articles, &foo, 1);
 
   foo.number = 1;
-  foo.product = "can vanilla ice cream";
+  foo.product = g_strdup ("can vanilla ice cream");
   foo.yummy = 60;
   g_array_append_vals (articles, &foo, 1);
 
   foo.number = 6;
-  foo.product = "eggs";
+  foo.product = g_strdup ("eggs");
   foo.yummy = 10;
   g_array_append_vals (articles, &foo, 1);
 }



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