[gnome-builder] projects: compare pointers before free/strdupv



commit 40fc3c0178e85d94959642f1dcace876ef161ef7
Author: Christian Hergert <chergert redhat com>
Date:   Tue Jan 22 11:38:59 2019 -0800

    projects: compare pointers before free/strdupv

 src/libide/projects/ide-project-info.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/libide/projects/ide-project-info.c b/src/libide/projects/ide-project-info.c
index 68840909d..a90c82fb8 100644
--- a/src/libide/projects/ide-project-info.c
+++ b/src/libide/projects/ide-project-info.c
@@ -136,9 +136,12 @@ ide_project_info_set_languages (IdeProjectInfo  *self,
 {
   g_return_if_fail (IDE_IS_PROJECT_INFO (self));
 
-  g_strfreev (self->languages);
-  self->languages = g_strdupv (languages);
-  g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_LANGUAGES]);
+  if (languages != self->languages)
+    {
+      g_strfreev (self->languages);
+      self->languages = g_strdupv (languages);
+      g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_LANGUAGES]);
+    }
 }
 
 gint


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