[gnome-builder] build-panel: don't leak diagnostic
- From: Christian Hergert <chergert src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gnome-builder] build-panel: don't leak diagnostic
 
- Date: Wed,  3 Jan 2018 12:33:14 +0000 (UTC)
 
commit bd5e345cf9fd2520739648088c7ee2f23f896f5a
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jan 3 04:31:17 2018 -0800
    build-panel: don't leak diagnostic
 src/libide/buildui/ide-build-panel.c |   18 +++++-------------
 1 files changed, 5 insertions(+), 13 deletions(-)
---
diff --git a/src/libide/buildui/ide-build-panel.c b/src/libide/buildui/ide-build-panel.c
index ceb5eaa..fd31ec6 100644
--- a/src/libide/buildui/ide-build-panel.c
+++ b/src/libide/buildui/ide-build-panel.c
@@ -281,9 +281,9 @@ ide_build_panel_diagnostic_activated (IdeBuildPanel     *self,
                                       GtkTreeViewColumn *colun,
                                       GtkTreeView       *tree_view)
 {
+  g_autoptr(IdeDiagnostic) diagnostic = NULL;
   g_autoptr(IdeUri) uri = NULL;
   IdeSourceLocation *loc;
-  IdeDiagnostic *diagnostic = NULL;
   IdeWorkbench *workbench;
   GtkTreeModel *model;
   GtkTreeIter iter;
@@ -303,15 +303,9 @@ ide_build_panel_diagnostic_activated (IdeBuildPanel     *self,
                       COLUMN_DIAGNOSTIC, &diagnostic,
                       -1);
 
-  if (diagnostic == NULL)
-    IDE_EXIT;
-
-  loc = ide_diagnostic_get_location (diagnostic);
-  if (loc == NULL)
-    IDE_EXIT;
-
-  uri = ide_source_location_get_uri (loc);
-  if (uri == NULL)
+  if (diagnostic == NULL ||
+      NULL == (loc = ide_diagnostic_get_location (diagnostic)) ||
+      NULL == (uri = ide_source_location_get_uri (loc)))
     IDE_EXIT;
 
   workbench = ide_widget_get_workbench (GTK_WIDGET (self));
@@ -320,9 +314,7 @@ ide_build_panel_diagnostic_activated (IdeBuildPanel     *self,
                                 uri,
                                 "editor",
                                 IDE_WORKBENCH_OPEN_FLAGS_NONE,
-                                NULL,
-                                NULL,
-                                NULL);
+                                NULL, NULL, NULL);
 
   IDE_EXIT;
 }
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]