[anjuta] build-basic-autotools: guard against NULL project_uri when build is configured
- From: Carl-Anton Ingmarsson <carlantoni src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] build-basic-autotools: guard against NULL project_uri when build is configured
- Date: Fri, 17 May 2013 22:21:42 +0000 (UTC)
commit 812b4af087d508d4789a2cb5bc744e1295b07d43
Author: Carl-Anton Ingmarsson <ca ingmarsson gmail com>
Date: Sat May 18 00:21:26 2013 +0200
build-basic-autotools: guard against NULL project_uri when build is configured
plugins/build-basic-autotools/build.c | 30 ++++++++++++--------
plugins/build-basic-autotools/configuration-list.c | 5 ++-
2 files changed, 22 insertions(+), 13 deletions(-)
---
diff --git a/plugins/build-basic-autotools/build.c b/plugins/build-basic-autotools/build.c
index fab04a7..fba25c2 100644
--- a/plugins/build-basic-autotools/build.c
+++ b/plugins/build-basic-autotools/build.c
@@ -899,26 +899,32 @@ build_project_configured (GObject *sender,
{
BuildContext *context = (BuildContext *)handle;
BasicAutotoolsPlugin *plugin = (BasicAutotoolsPlugin *)(context == NULL ? (void *)sender :
(void *)build_context_get_plugin (context));
- GValue *value;
GFile *file;
- gchar *uri;
/* FIXME: check if build directory correspond, configuration could have changed */
- value = g_new0 (GValue, 1);
- g_value_init (value, G_TYPE_STRING);
file = build_configuration_list_get_build_file (plugin->configurations,
build_configuration_list_get_selected (plugin->configurations));
- uri = g_file_get_uri (file);
- g_value_set_string (value, uri);
- g_free (uri);
- g_object_unref (file);
+ if (file)
+ {
+ GValue value = G_VALUE_INIT;
+ gchar *uri;
- anjuta_shell_add_value (ANJUTA_PLUGIN (plugin)->shell, IANJUTA_BUILDER_ROOT_URI, value, NULL);
+ uri = g_file_get_uri (file);
+ g_value_init (&value, G_TYPE_STRING);
+ g_value_set_string (&value, uri);
+ g_free (uri);
+ g_object_unref (file);
+
+ anjuta_shell_add_value (ANJUTA_PLUGIN (plugin)->shell, IANJUTA_BUILDER_ROOT_URI,
&value, NULL);
+ g_value_unset (&value);
- build_update_configuration_menu (plugin);
+ /* Call build function if necessary */
+ if ((pack) && (pack->func != NULL)) pack->func (plugin, pack->file, pack->callback,
pack->user_data, NULL);
+ }
+ else
+ anjuta_shell_remove_value (ANJUTA_PLUGIN (plugin)->shell, IANJUTA_BUILDER_ROOT_URI,
NULL);
- /* Call build function if necessary */
- if ((pack) && (pack->func != NULL)) pack->func (plugin, pack->file, pack->callback,
pack->user_data, NULL);
+ build_update_configuration_menu (plugin);
}
if (pack)
diff --git a/plugins/build-basic-autotools/configuration-list.c
b/plugins/build-basic-autotools/configuration-list.c
index 5d4a9aa..109ef8b 100644
--- a/plugins/build-basic-autotools/configuration-list.c
+++ b/plugins/build-basic-autotools/configuration-list.c
@@ -421,8 +421,11 @@ build_configuration_list_get_build_file (BuildConfigurationList *list, BuildConf
{
GFile *build;
+ if (!list->project_root_uri)
+ return NULL;
+
build = g_file_new_for_uri (list->project_root_uri);
- if ((list->project_root_uri != NULL) && (cfg->build_uri != NULL))
+ if (cfg->build_uri != NULL)
{
GFile *root;
root = build;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]