[gnome-builder] build: be explicit when assigning from reference



commit ed58d6460b239fb9a51163245fd89b43ee8ea296
Author: Christian Hergert <chergert redhat com>
Date:   Wed Nov 22 00:24:37 2017 -0800

    build: be explicit when assigning from reference
    
    When translating between types using g_object_ref() or
    g_object_ref_sink(), be explicit about the type we are
    expecting at the destination.
    
    This also fixes things in case the GLib patch lands to add
    type-propagation to this API.

 src/libide/buildsystem/ide-build-stage.c           |    2 +-
 src/libide/search/ide-search-entry.c               |    2 +-
 src/libide/sourceview/ide-source-view.c            |    4 +++-
 .../gb-color-picker-document-monitor.c             |    2 +-
 .../flatpak/gbp-flatpak-application-addin.c        |    2 +-
 src/plugins/git/ide-git-buffer-change-monitor.c    |    2 +-
 src/plugins/terminal/gb-terminal-view-actions.c    |    2 +-
 src/plugins/xml-pack/ide-xml-completion-provider.c |    2 +-
 8 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/src/libide/buildsystem/ide-build-stage.c b/src/libide/buildsystem/ide-build-stage.c
index 77e7fc7..a2c2ddf 100644
--- a/src/libide/buildsystem/ide-build-stage.c
+++ b/src/libide/buildsystem/ide-build-stage.c
@@ -730,7 +730,7 @@ ide_build_stage_observe_stream (IdeBuildStage     *self,
   g_assert (G_IS_INPUT_STREAM (stream));
 
   if (G_IS_DATA_INPUT_STREAM (stream))
-    data_stream = g_object_ref (stream);
+    data_stream = g_object_ref (G_DATA_INPUT_STREAM (stream));
   else
     data_stream = g_data_input_stream_new (stream);
 
diff --git a/src/libide/search/ide-search-entry.c b/src/libide/search/ide-search-entry.c
index 1b4fddc..4de30e3 100644
--- a/src/libide/search/ide-search-entry.c
+++ b/src/libide/search/ide-search-entry.c
@@ -169,7 +169,7 @@ suggestion_activated (DzlSuggestionEntry *entry,
        */
 
       da = g_slice_new0 (DelayedActivate);
-      da->editor = g_object_ref (perspective);
+      da->editor = g_object_ref (IDE_EDITOR_PERSPECTIVE (perspective));
       da->location = g_steal_pointer (&location);
 
       gdk_threads_add_timeout_full (G_PRIORITY_LOW,
diff --git a/src/libide/sourceview/ide-source-view.c b/src/libide/sourceview/ide-source-view.c
index 8664793..b66af8a 100644
--- a/src/libide/sourceview/ide-source-view.c
+++ b/src/libide/sourceview/ide-source-view.c
@@ -4003,7 +4003,9 @@ ide_source_view_constructed (GObject *object)
   priv->omni_renderer = g_object_new (IDE_TYPE_OMNI_GUTTER_RENDERER,
                                       "visible", TRUE,
                                       NULL);
-  gtk_source_gutter_insert (gutter, g_object_ref_sink (priv->omni_renderer), 0);
+  gtk_source_gutter_insert (gutter,
+                            g_object_ref_sink (GTK_SOURCE_GUTTER_RENDERER (priv->omni_renderer)),
+                            0);
 }
 
 static void
diff --git a/src/plugins/color-picker/gb-color-picker-document-monitor.c 
b/src/plugins/color-picker/gb-color-picker-document-monitor.c
index 0a3f632..c4ccca7 100644
--- a/src/plugins/color-picker/gb-color-picker-document-monitor.c
+++ b/src/plugins/color-picker/gb-color-picker-document-monitor.c
@@ -703,7 +703,7 @@ gb_color_picker_document_monitor_queue_oper (GbColorPickerDocumentMonitor *self,
     real_end = *end;
 
   queued.self = g_object_ref (self);
-  queued.buffer = g_object_ref (self->buffer);
+  queued.buffer = g_object_ref (buffer);
   queued.begin = g_object_ref (gtk_text_buffer_create_mark (buffer, NULL, &real_begin, TRUE));
   queued.end = g_object_ref (gtk_text_buffer_create_mark (buffer, NULL, &real_end, FALSE));
   queued.uncolorize = !!uncolorize;
diff --git a/src/plugins/flatpak/gbp-flatpak-application-addin.c 
b/src/plugins/flatpak/gbp-flatpak-application-addin.c
index 43016d6..6e966af 100644
--- a/src/plugins/flatpak/gbp-flatpak-application-addin.c
+++ b/src/plugins/flatpak/gbp-flatpak-application-addin.c
@@ -1232,7 +1232,7 @@ gbp_flatpak_application_addin_find_ref (GbpFlatpakApplicationAddin *self,
               if (g_strcmp0 (id, flatpak_ref_get_name (ref)) == 0 &&
                   g_strcmp0 (arch, flatpak_ref_get_arch (ref)) == 0 &&
                   g_strcmp0 (branch, flatpak_ref_get_branch (ref)) == 0)
-                return g_object_ref (ref);
+                return g_object_ref (FLATPAK_INSTALLED_REF (ref));
             }
         }
     }
diff --git a/src/plugins/git/ide-git-buffer-change-monitor.c b/src/plugins/git/ide-git-buffer-change-monitor.c
index 2c523d2..0819a23 100644
--- a/src/plugins/git/ide-git-buffer-change-monitor.c
+++ b/src/plugins/git/ide-git-buffer-change-monitor.c
@@ -622,7 +622,7 @@ ide_git_buffer_change_monitor_calculate_threaded (IdeGitBufferChangeMonitor  *se
       if (!blob)
         goto cleanup;
 
-      diff->blob = g_object_ref (blob);
+      diff->blob = g_object_ref (GGIT_BLOB (blob));
 
     cleanup:
       g_clear_object (&blob);
diff --git a/src/plugins/terminal/gb-terminal-view-actions.c b/src/plugins/terminal/gb-terminal-view-actions.c
index 26d5e9d..dc97e61 100644
--- a/src/plugins/terminal/gb-terminal-view-actions.c
+++ b/src/plugins/terminal/gb-terminal-view-actions.c
@@ -128,7 +128,7 @@ gb_terminal_view_actions_save_async (GbTerminalView       *view,
     {
       savetask = g_slice_new0 (SaveTask);
       savetask->file = g_object_ref (file);
-      savetask->stream = g_object_ref (output_stream);
+      savetask->stream = g_object_ref (G_OUTPUT_STREAM (output_stream));
       savetask->terminal = g_object_ref (terminal);
 
       g_task_set_task_data (task, savetask, savetask_free);
diff --git a/src/plugins/xml-pack/ide-xml-completion-provider.c 
b/src/plugins/xml-pack/ide-xml-completion-provider.c
index 90ebeb0..29023f1 100644
--- a/src/plugins/xml-pack/ide-xml-completion-provider.c
+++ b/src/plugins/xml-pack/ide-xml-completion-provider.c
@@ -1041,7 +1041,7 @@ ide_xml_completion_provider_populate (GtkSourceCompletionProvider *self,
 
   buffer = IDE_BUFFER (gtk_text_iter_get_buffer (&iter));
 
-  state->self = g_object_ref (self);
+  state->self = g_object_ref (IDE_XML_COMPLETION_PROVIDER (self));
   state->completion_context = completion_context;
   state->cancellable = g_cancellable_new ();
   state->buffer = g_object_ref (buffer);


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