From a8fbe51b45cde89e801399db9fc9d8f1584e27eb Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 28 Jul 2016 00:38:46 +0200 Subject: [PATCH] Fix leak of GdkPixbufLoader in wxGTK wxAnimation Use wxGtkObject<> to ensure that the loader object is unref'd. Also add a missing call to gdk_pixbuf_loader_close() for consistency. Closes #17607. --- src/gtk/animate.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gtk/animate.cpp b/src/gtk/animate.cpp index a36a16f33d..23bfda42ae 100644 --- a/src/gtk/animate.cpp +++ b/src/gtk/animate.cpp @@ -23,6 +23,7 @@ #include "wx/wfstream.h" #include "wx/gtk/private.h" +#include "wx/gtk/private/object.h" #include @@ -116,6 +117,8 @@ bool wxAnimation::Load(wxInputStream &stream, wxAnimationType type) else loader = gdk_pixbuf_loader_new(); + wxGtkObject ensureUnrefLoader(loader); + if (!loader || error != NULL) // even if the loader was allocated, an error could have happened { @@ -156,6 +159,7 @@ bool wxAnimation::Load(wxInputStream &stream, wxAnimationType type) if (!data_written) { wxLogDebug("Could not read data from the stream..."); + gdk_pixbuf_loader_close(loader, NULL); return false; }