[gtksourceview/wip/chergert/snippets] make snippet chunk a ginitiallyunowned
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/snippets] make snippet chunk a ginitiallyunowned
- Date: Fri, 24 Jan 2020 20:29:39 +0000 (UTC)
commit 4b724f627dc957c6dcc8f460c87cb83e5ee16e0b
Author: Christian Hergert <chergert redhat com>
Date: Fri Jan 24 12:29:41 2020 -0800
make snippet chunk a ginitiallyunowned
gtksourceview/gtksourcesnippet.c | 3 +--
gtksourceview/gtksourcesnippetchunk.c | 4 ++--
gtksourceview/gtksourcesnippetchunk.h | 2 +-
gtksourceview/gtksourceview-snippets.c | 2 --
4 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/gtksourceview/gtksourcesnippet.c b/gtksourceview/gtksourcesnippet.c
index b24eb3c2..ffc7d3d7 100644
--- a/gtksourceview/gtksourcesnippet.c
+++ b/gtksourceview/gtksourcesnippet.c
@@ -230,7 +230,6 @@ gtk_source_snippet_copy (GtkSourceSnippet *self)
old_chunk = g_ptr_array_index (self->chunks, i);
new_chunk = gtk_source_snippet_chunk_copy (old_chunk);
gtk_source_snippet_add_chunk (ret, new_chunk);
- g_object_unref (new_chunk);
}
return g_steal_pointer (&ret);
@@ -781,7 +780,7 @@ gtk_source_snippet_add_chunk (GtkSourceSnippet *self,
g_return_if_fail (GTK_SOURCE_IS_SNIPPET_CHUNK (chunk));
g_return_if_fail (!self->inserted);
- g_ptr_array_add (self->chunks, g_object_ref (chunk));
+ g_ptr_array_add (self->chunks, g_object_ref_sink (chunk));
gtk_source_snippet_chunk_set_context (chunk, self->context);
diff --git a/gtksourceview/gtksourcesnippetchunk.c b/gtksourceview/gtksourcesnippetchunk.c
index 9606572b..75cf276e 100644
--- a/gtksourceview/gtksourcesnippetchunk.c
+++ b/gtksourceview/gtksourcesnippetchunk.c
@@ -37,7 +37,7 @@
struct _GtkSourceSnippetChunk
{
- GObject parent_instance;
+ GInitiallyUnowned parent_instance;
GtkSourceSnippetContext *context;
gchar *spec;
@@ -52,7 +52,7 @@ struct _GtkSourceSnippetChunk
guint text_set : 1;
};
-G_DEFINE_TYPE (GtkSourceSnippetChunk, gtk_source_snippet_chunk, G_TYPE_OBJECT)
+G_DEFINE_TYPE (GtkSourceSnippetChunk, gtk_source_snippet_chunk, G_TYPE_INITIALLY_UNOWNED)
enum {
PROP_0,
diff --git a/gtksourceview/gtksourcesnippetchunk.h b/gtksourceview/gtksourcesnippetchunk.h
index 460478e8..fb150d69 100644
--- a/gtksourceview/gtksourcesnippetchunk.h
+++ b/gtksourceview/gtksourcesnippetchunk.h
@@ -32,7 +32,7 @@ G_BEGIN_DECLS
#define GTK_SOURCE_TYPE_SNIPPET_CHUNK (gtk_source_snippet_chunk_get_type())
GTK_SOURCE_AVAILABLE_IN_5_0
-G_DECLARE_FINAL_TYPE (GtkSourceSnippetChunk, gtk_source_snippet_chunk, GTK_SOURCE, SNIPPET_CHUNK, GObject)
+G_DECLARE_FINAL_TYPE (GtkSourceSnippetChunk, gtk_source_snippet_chunk, GTK_SOURCE, SNIPPET_CHUNK,
GInitiallyUnowned)
GTK_SOURCE_AVAILABLE_IN_5_0
GtkSourceSnippetChunk *gtk_source_snippet_chunk_new (void);
diff --git a/gtksourceview/gtksourceview-snippets.c b/gtksourceview/gtksourceview-snippets.c
index 76664e3a..05b6765b 100644
--- a/gtksourceview/gtksourceview-snippets.c
+++ b/gtksourceview/gtksourceview-snippets.c
@@ -329,13 +329,11 @@ lookup_snippet_by_trigger (GtkSourceViewSnippets *snippets,
gtk_source_snippet_chunk_set_spec (chunk, "$1");
gtk_source_snippet_chunk_set_focus_position (chunk, i+1);
gtk_source_snippet_add_chunk (snippet, chunk);
- g_object_unref (chunk);
}
chunk = gtk_source_snippet_chunk_new ();
gtk_source_snippet_chunk_set_focus_position (chunk, 0);
gtk_source_snippet_add_chunk (snippet, chunk);
- g_object_unref (chunk);
return snippet;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]