[anjuta] am-project: bgo #654092 - Crash when adding a project file (due to the introduction of object nodes)



commit 017c43a85928462a266f00b3c31441a3fadf3db8
Author: SÃbastien Granjoux <seb sfo free fr>
Date:   Wed Jul 6 21:28:49 2011 +0200

    am-project: bgo #654092 - Crash when adding a project file (due to the introduction of object nodes)

 plugins/am-project/am-writer.c |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/plugins/am-project/am-writer.c b/plugins/am-project/am-writer.c
index 332f2bd..43fbac1 100644
--- a/plugins/am-project/am-writer.c
+++ b/plugins/am-project/am-writer.c
@@ -1075,14 +1075,30 @@ amp_source_node_create_token (AmpProject  *project, AmpSourceNode *source, GErro
 	after = TRUE;
 	for (sibling = anjuta_project_node_prev_sibling (ANJUTA_PROJECT_NODE (source)); sibling != NULL; sibling = anjuta_project_node_prev_sibling (sibling))
 	{
-		if (anjuta_project_node_get_node_type (sibling) == ANJUTA_PROJECT_SOURCE) break;
+		if (anjuta_project_node_get_node_type (sibling) == ANJUTA_PROJECT_SOURCE)
+		{
+			break;
+		}
+		else if (anjuta_project_node_get_node_type (sibling) == ANJUTA_PROJECT_OBJECT)
+		{
+			sibling = anjuta_project_node_first_child (sibling);
+			break;
+		}
 	}
 	if (sibling == NULL)
 	{
 		after = FALSE;
 		for (sibling = anjuta_project_node_next_sibling (ANJUTA_PROJECT_NODE (source)); sibling != NULL; sibling = anjuta_project_node_next_sibling (sibling))
 		{
-			if (anjuta_project_node_get_node_type (sibling) == ANJUTA_PROJECT_SOURCE) break;
+			if (anjuta_project_node_get_node_type (sibling) == ANJUTA_PROJECT_SOURCE)
+			{
+				break;
+			}
+			else if (anjuta_project_node_get_node_type (sibling) == ANJUTA_PROJECT_OBJECT)
+			{
+				sibling = anjuta_project_node_first_child (sibling);
+				break;
+ 			}
 		}
 	}
 	if (sibling == NULL)
@@ -1291,7 +1307,7 @@ amp_property_rename_target (AmpProject *project, AnjutaProjectNode *node)
 	AnjutaToken *update = NULL;
 	AnjutaToken *existing_target_list;
 	gboolean after;
-	const gchar *target_dir;
+	gchar *target_dir;
 
 	g_return_val_if_fail (anjuta_project_node_get_node_type (node) == ANJUTA_PROJECT_TARGET, NULL);
 



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