[anjuta] am-project: Fix a crash when adding a source or a target to an empty variable
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] am-project: Fix a crash when adding a source or a target to an empty variable
- Date: Fri, 8 Jul 2011 17:46:22 +0000 (UTC)
commit f4ddcffa08138abf09fb5def862b0e78069689c8
Author: SÃbastien Granjoux <seb sfo free fr>
Date: Wed Jul 6 22:30:58 2011 +0200
am-project: Fix a crash when adding a source or a target to an empty variable
plugins/am-project/am-writer.c | 6 ++--
plugins/am-project/tests/data_target.at | 6 +---
plugins/am-project/tests/source.at | 33 +++++++++++++++++++++++++++++++
plugins/am-project/tests/target.at | 28 ++++++++++++++++++++++++++
4 files changed, 66 insertions(+), 7 deletions(-)
---
diff --git a/plugins/am-project/am-writer.c b/plugins/am-project/am-writer.c
index 43fbac1..fe442de 100644
--- a/plugins/am-project/am-writer.c
+++ b/plugins/am-project/am-writer.c
@@ -867,7 +867,7 @@ amp_target_node_create_token (AmpProject *project, AmpTargetNode *target, GErro
if ((value != NULL) && (strcmp (targetname, value) == 0))
{
g_free (value);
- args = anjuta_token_last_item (anjuta_token_list ((AnjutaToken *)last->data));
+ args = anjuta_token_last_item ((AnjutaToken *)last->data);
break;
}
g_free (value);
@@ -1119,14 +1119,14 @@ amp_source_node_create_token (AmpProject *project, AmpSourceNode *source, GErro
GList *last;
for (last = amp_target_node_get_token (target, AM_TOKEN__SOURCES); last != NULL; last = g_list_next (last))
{
- args = anjuta_token_last_item (anjuta_token_list ((AnjutaToken *)last->data));
+ args = anjuta_token_last_item ((AnjutaToken *)last->data);
break;
}
if (last == NULL)
{
for (last = amp_target_node_get_token (target, AM_TOKEN__DATA); last != NULL; last = g_list_next (last))
{
- args = anjuta_token_last_item (anjuta_token_list ((AnjutaToken *)last->data));
+ args = anjuta_token_last_item ((AnjutaToken *)last->data);
break;
}
}
diff --git a/plugins/am-project/tests/data_target.at b/plugins/am-project/tests/data_target.at
index 8a9af36..a94f05e 100644
--- a/plugins/am-project/tests/data_target.at
+++ b/plugins/am-project/tests/data_target.at
@@ -79,8 +79,7 @@ AT_DATA([reference],
target1dir = $(target_dir)
target1_DATA = data1.txt
-data_DATA = \
- data4.txt \
+data_DATA = data4.txt \
data5.txt
]])
AT_PARSER_CHECK([load data1 \
@@ -108,8 +107,7 @@ AT_DATA([reference],
[[## Process this file with automake to produce Makefile.in
-data_DATA = \
- data4.txt \
+data_DATA = data4.txt \
data5.txt
]])
AT_PARSER_CHECK([load data2 \
diff --git a/plugins/am-project/tests/source.at b/plugins/am-project/tests/source.at
index 9cd5567..47e325a 100644
--- a/plugins/am-project/tests/source.at
+++ b/plugins/am-project/tests/source.at
@@ -134,4 +134,37 @@ AT_CHECK([diff -b output expect])
+AS_MKDIR_P([empty6])
+AT_DATA([empty6/configure.ac],
+[[AC_CONFIG_FILES(Makefile)
+]])
+AT_DATA([empty6/Makefile.am],
+[[
+bin_PROGRAMS = target1
+
+target1_SOURCES =
+]])
+AT_DATA([expect],
+[[ GROUP (): empty6
+ TARGET (): target1
+ PROPERTY (Installation directory): bindir
+ SOURCE (): source1
+]])
+AT_DATA([reference],
+[[
+bin_PROGRAMS = target1
+
+target1_SOURCES =source1
+]])
+AT_PARSER_CHECK([load empty6 \
+ add source 0:0 source1 \
+ list \
+ save])
+AT_CHECK([diff -b empty6/Makefile.am reference])
+AT_PARSER_CHECK([load empty6 \
+ list])
+AT_CHECK([diff -b output expect])
+
+
+
AT_CLEANUP
diff --git a/plugins/am-project/tests/target.at b/plugins/am-project/tests/target.at
index a10fe34..6bb4803 100644
--- a/plugins/am-project/tests/target.at
+++ b/plugins/am-project/tests/target.at
@@ -239,4 +239,32 @@ AT_CHECK([diff -b output expect])
+AS_MKDIR_P([empty10])
+AT_DATA([empty10/configure.ac],
+[[AC_CONFIG_FILES(Makefile)
+]])
+AT_DATA([empty10/Makefile.am],
+[[
+bin_PROGRAMS =
+]])
+AT_DATA([expect],
+[[ GROUP (): empty10
+ TARGET (): target1
+ PROPERTY (Installation directory): bindir
+]])
+AT_DATA([reference],
+[[
+bin_PROGRAMS =target1
+]])
+AT_PARSER_CHECK([load empty10 \
+ add target 0 target1 prog \
+ list \
+ save])
+AT_CHECK([diff -b empty10/Makefile.am reference])
+AT_PARSER_CHECK([load empty10 \
+ list])
+AT_CHECK([diff output expect])
+
+
+
AT_CLEANUP
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]