[anjuta] am-project: bgo #666621 - segfault in amp_node_property_add when there is an orphan AmpTargetNode



commit 8e277376cb3ac79dac647c065dbab9d235b160d0
Author: SÃbastien Granjoux <seb sfo free fr>
Date:   Fri Dec 23 22:07:15 2011 +0100

    am-project: bgo #666621 - segfault in amp_node_property_add when there is an orphan AmpTargetNode

 libanjuta/anjuta-project.c          |    1 -
 plugins/am-project/am-properties.c  |    2 ++
 plugins/am-project/tests/anjuta.lst |    5 ++++-
 plugins/am-project/tests/bugs.at    |   22 ++++++++++++++++++++++
 4 files changed, 28 insertions(+), 2 deletions(-)
---
diff --git a/libanjuta/anjuta-project.c b/libanjuta/anjuta-project.c
index b63ca53..7f33d82 100644
--- a/libanjuta/anjuta-project.c
+++ b/libanjuta/anjuta-project.c
@@ -986,7 +986,6 @@ anjuta_project_node_remove_property (AnjutaProjectNode *node, AnjutaProjectPrope
 	if (prop != prop->info->default_value)
 	{
 		node->properties = g_list_remove (node->properties, prop);
-		prop->info = NULL;
 	}
 
 	return prop;
diff --git a/plugins/am-project/am-properties.c b/plugins/am-project/am-properties.c
index 44a4213..6e75ebc 100644
--- a/plugins/am-project/am-properties.c
+++ b/plugins/am-project/am-properties.c
@@ -1107,6 +1107,7 @@ amp_property_new (const gchar *name, AnjutaTokenType type, gint position, const
 void
 amp_property_free (AnjutaProjectProperty *prop)
 {
+	amp_property_info_free (prop->info);
 	g_free (prop->name);
 	g_free (prop->value);
 	g_slice_free (AmpProperty, (AmpProperty *)prop);
@@ -1201,6 +1202,7 @@ amp_node_property_add (AnjutaProjectNode *node, AnjutaProjectProperty *new_prop)
 
 			if (g_strcmp0 (new_prop->value, info->base.default_value->value) != 0)
 			{
+				amp_property_info_free (new_prop->info);
 				anjuta_project_node_insert_property (node, (AnjutaProjectPropertyInfo *)info, new_prop);
 				set = TRUE;
 			}
diff --git a/plugins/am-project/tests/anjuta.lst b/plugins/am-project/tests/anjuta.lst
index 9a04f10..9cd8652 100644
--- a/plugins/am-project/tests/anjuta.lst
+++ b/plugins/am-project/tests/anjuta.lst
@@ -2098,11 +2098,14 @@ ROOT (): anjuta
                 SOURCE (): plugins/snippets-manager/snippets-import-export.c
                 SOURCE (): plugins/snippets-manager/snippets-import-export.h
         GROUP (): sourceview
-            PROPERTY (Installation directories): sourceview_xmldir = $(datadir)/anjuta/glade sourceview_pixmapsdir = $(datadir)/pixmaps/anjuta sourceview_plugindir = $(libdir)/anjuta plugindir = $(libdir)/anjuta
+            PROPERTY (Installation directories): sourceview_xmldir = $(datadir)/anjuta/glade sourceview_uidir = $(datadir)/anjuta/ui sourceview_pixmapsdir = $(datadir)/pixmaps/anjuta sourceview_plugindir = $(libdir)/anjuta plugindir = $(libdir)/anjuta
             PROPERTY (C preprocessor flags): $(WARN_CFLAGS) $(DEPRECATED_FLAGS) $(GIO_CFLAGS) $(SOURCEVIEW_CFLAGS) $(ANJUTA_CFLAGS) $(GDL_CFLAGS) $(DEPRECATED_FLAGS) -I$(top_srcdir) -I$(top_builddir)/libanjuta -DPACKAGE_PIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)"\" -DPACKAGE_LIB_DIR=\""$(pkglibdir)"\" -DPACKAGE_DATA_DIR=\""$(datadir)/$(PACKAGE)"\" -DG_LOG_DOMAIN=\"sourceview\"
             TARGET (): sourceview_xml
                 PROPERTY (Installation directory): sourceview_xmldir
                 SOURCE (): plugins/sourceview/anjuta-editor-sourceview.ui
+            TARGET (): sourceview_ui
+                PROPERTY (Installation directory): sourceview_uidir
+                SOURCE (): plugins/sourceview/anjuta-sourceview.xml
             TARGET (): sourceview_pixmaps
                 PROPERTY (Installation directory): sourceview_pixmapsdir
                 SOURCE (): plugins/sourceview/anjuta-editor-sourceview-plugin-48.png
diff --git a/plugins/am-project/tests/bugs.at b/plugins/am-project/tests/bugs.at
index ef9464f..6f2c0ec 100644
--- a/plugins/am-project/tests/bugs.at
+++ b/plugins/am-project/tests/bugs.at
@@ -25,4 +25,26 @@ AT_CHECK([diff output expect])
 
 
 
+AS_MKDIR_P([project2])
+AT_DATA([project2/configure.ac],
+[[
+AC_CONFIG_FILES(Makefile)
+]])
+AT_DATA([project2/Makefile.am],
+[[
+program_CFLAGS=-g
+noinst_PROGRAMS = program
+]])
+AT_DATA([expect],
+[[ROOT (): project2
+    TARGET (): program
+        PROPERTY (C compiler flags): -g
+        PROPERTY (Do not install): true
+]])
+AT_PARSER_CHECK([load project2 \
+		 list])
+AT_CHECK([diff output expect])
+
+
+
 AT_CLEANUP



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