[gnome-builder/wip/gtk4-port] libide/editor: keep hold on IdeBuffer
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port] libide/editor: keep hold on IdeBuffer
- Date: Mon, 4 Apr 2022 21:57:15 +0000 (UTC)
commit bff0c6b82cb5c92158627a0a0d5bd75a3ec90b9e
Author: Christian Hergert <chergert redhat com>
Date: Mon Apr 4 14:57:10 2022 -0700
libide/editor: keep hold on IdeBuffer
We don't want this to get GC'd periodically due to IdeObjectBox cleanup,
so ensure we add a hold on the object while the view is active.
src/libide/editor/ide-editor-page.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/editor/ide-editor-page.c b/src/libide/editor/ide-editor-page.c
index 446b06abf..66ed3ce94 100644
--- a/src/libide/editor/ide-editor-page.c
+++ b/src/libide/editor/ide-editor-page.c
@@ -61,6 +61,8 @@ ide_editor_page_set_buffer (IdeEditorPage *self,
if (g_set_object (&self->buffer, buffer))
{
+ ide_buffer_hold (buffer);
+
gtk_text_view_set_buffer (GTK_TEXT_VIEW (self->view), GTK_TEXT_BUFFER (buffer));
g_signal_connect_object (buffer,
@@ -118,7 +120,12 @@ ide_editor_page_dispose (GObject *object)
g_clear_object (&self->buffer_file_settings);
g_clear_object (&self->view_file_settings);
- g_clear_object (&self->buffer);
+
+ if (self->buffer != NULL)
+ {
+ ide_buffer_release (self->buffer);
+ g_clear_object (&self->buffer);
+ }
G_OBJECT_CLASS (ide_editor_page_parent_class)->dispose (object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]