[gnome-builder] pipeline: don't leak launcher upon set_property
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] pipeline: don't leak launcher upon set_property
- Date: Mon, 13 Mar 2017 03:38:43 +0000 (UTC)
commit 0f49621cc3188ca9b4373464f0c8163aa8eed140
Author: Christian Hergert <chergert redhat com>
Date: Sun Mar 12 20:38:04 2017 -0700
pipeline: don't leak launcher upon set_property
libide/buildsystem/ide-build-stage-launcher.c | 28 ++++++++++++++++++++++--
libide/buildsystem/ide-build-stage-launcher.h | 2 +
2 files changed, 27 insertions(+), 3 deletions(-)
---
diff --git a/libide/buildsystem/ide-build-stage-launcher.c b/libide/buildsystem/ide-build-stage-launcher.c
index 40c2ec5..46f77ef 100644
--- a/libide/buildsystem/ide-build-stage-launcher.c
+++ b/libide/buildsystem/ide-build-stage-launcher.c
@@ -289,7 +289,6 @@ ide_build_stage_launcher_set_property (GObject *object,
GParamSpec *pspec)
{
IdeBuildStageLauncher *self = (IdeBuildStageLauncher *)object;
- IdeBuildStageLauncherPrivate *priv = ide_build_stage_launcher_get_instance_private (self);
switch (prop_id)
{
@@ -302,7 +301,7 @@ ide_build_stage_launcher_set_property (GObject *object,
break;
case PROP_LAUNCHER:
- priv->launcher = g_value_dup_object (value);
+ ide_build_stage_launcher_set_launcher (self, g_value_get_object (value));
break;
default:
@@ -345,7 +344,7 @@ ide_build_stage_launcher_class_init (IdeBuildStageLauncherClass *klass)
"The subprocess launcher to execute",
IDE_TYPE_SUBPROCESS_LAUNCHER,
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
+
g_object_class_install_properties (object_class, N_PROPS, properties);
}
@@ -369,6 +368,29 @@ ide_build_stage_launcher_get_launcher (IdeBuildStageLauncher *self)
return priv->launcher;
}
+void
+ide_build_stage_launcher_set_launcher (IdeBuildStageLauncher *self,
+ IdeSubprocessLauncher *launcher)
+{
+ IdeBuildStageLauncherPrivate *priv = ide_build_stage_launcher_get_instance_private (self);
+
+ g_return_if_fail (IDE_IS_BUILD_STAGE_LAUNCHER (self));
+ g_return_if_fail (!launcher || IDE_IS_SUBPROCESS_LAUNCHER (launcher));
+
+ if (g_set_object (&priv->launcher, launcher))
+ g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_LAUNCHER]);
+}
+
+/**
+ * ide_build_stage_launcher_new:
+ * @context: An #IdeContext
+ * @launcher: (nullable): An #IdeSubprocessLauncher or %NULL
+ *
+ * Creates a new #IdeBuildStageLauncher that can be attached to an
+ * #IdeBuildPipeline.
+ *
+ * Returns: (transfer full): An #IdeBuildStageLauncher
+ */
IdeBuildStage *
ide_build_stage_launcher_new (IdeContext *context,
IdeSubprocessLauncher *launcher)
diff --git a/libide/buildsystem/ide-build-stage-launcher.h b/libide/buildsystem/ide-build-stage-launcher.h
index da9040b..28e4342 100644
--- a/libide/buildsystem/ide-build-stage-launcher.h
+++ b/libide/buildsystem/ide-build-stage-launcher.h
@@ -45,6 +45,8 @@ struct _IdeBuildStageLauncherClass
IdeBuildStage *ide_build_stage_launcher_new (IdeContext *context,
IdeSubprocessLauncher *launcher);
IdeSubprocessLauncher *ide_build_stage_launcher_get_launcher (IdeBuildStageLauncher *self);
+void ide_build_stage_launcher_set_launcher (IdeBuildStageLauncher *self,
+ IdeSubprocessLauncher *launcher);
IdeSubprocessLauncher *ide_build_stage_launcher_get_clean_launcher (IdeBuildStageLauncher *self);
void ide_build_stage_launcher_set_clean_launcher (IdeBuildStageLauncher *self,
IdeSubprocessLauncher
*clean_launcher);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]