[gnome-builder/gnome-builder-3-28] buffer: don't leak buffer when loading files
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/gnome-builder-3-28] buffer: don't leak buffer when loading files
- Date: Mon, 16 Apr 2018 09:40:09 +0000 (UTC)
commit 44a01ddb29c7b604d1ad23777528537194290995
Author: Christian Hergert <chergert redhat com>
Date: Mon Apr 16 02:36:18 2018 -0700
buffer: don't leak buffer when loading files
The buffer from this is transfer-full, so we need to be sure we
unref the result to avoid leaking buffers.
src/libide/editor/ide-editor-perspective.c | 3 ++-
src/libide/ide-context.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/libide/editor/ide-editor-perspective.c b/src/libide/editor/ide-editor-perspective.c
index b8bfa8711..486a2303a 100644
--- a/src/libide/editor/ide-editor-perspective.c
+++ b/src/libide/editor/ide-editor-perspective.c
@@ -422,6 +422,7 @@ ide_editor_perspective_focus_location_cb (GObject *object,
gpointer user_data)
{
IdeBufferManager *bufmgr = (IdeBufferManager *)object;
+ g_autoptr(IdeBuffer) buffer = NULL;
FocusLocation *state = user_data;
GError *error = NULL;
@@ -432,7 +433,7 @@ ide_editor_perspective_focus_location_cb (GObject *object,
g_assert (IDE_IS_EDITOR_PERSPECTIVE (state->self));
g_assert (state->location != NULL);
- if (!ide_buffer_manager_load_file_finish (bufmgr, result, &error))
+ if (!(buffer = ide_buffer_manager_load_file_finish (bufmgr, result, &error)))
{
/* TODO: display warning breifly to the user in the frame? */
g_warning ("%s", error->message);
diff --git a/src/libide/ide-context.c b/src/libide/ide-context.c
index b26b151cc..c13711829 100644
--- a/src/libide/ide-context.c
+++ b/src/libide/ide-context.c
@@ -2152,12 +2152,13 @@ ide_context_restore__load_file_cb (GObject *object,
{
IdeBufferManager *buffer_manager = (IdeBufferManager *)object;
g_autoptr(IdeTask) task = user_data;
+ g_autoptr(IdeBuffer) buffer = NULL;
g_autoptr(GError) error = NULL;
g_assert (IDE_IS_BUFFER_MANAGER (buffer_manager));
g_assert (IDE_IS_TASK (task));
- if (!ide_buffer_manager_load_file_finish (buffer_manager, result, &error))
+ if (!(buffer = ide_buffer_manager_load_file_finish (buffer_manager, result, &error)))
{
g_warning ("%s", error->message);
/* TODO: add error into grouped error */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]