]> git.saurik.com Git - wxWidgets.git/commitdiff
fix memory leak in Freeze
authorPaul Cornett <paulcor@bullseye.com>
Thu, 19 Oct 2006 02:53:54 +0000 (02:53 +0000)
committerPaul Cornett <paulcor@bullseye.com>
Thu, 19 Oct 2006 02:53:54 +0000 (02:53 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42108 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/textctrl.cpp

index 182d64038a18776ddc6f418ebdd6529a705227ff..926d11283fc8ec64183422b568afe0a7167b575a 100644 (file)
@@ -16,7 +16,6 @@
     #include "wx/intl.h"
     #include "wx/log.h"
     #include "wx/utils.h"
-    #include "wx/panel.h"
     #include "wx/settings.h"
     #include "wx/math.h"
 #endif
@@ -29,7 +28,6 @@
 #include <ctype.h>
 
 #include "wx/gtk/private.h"
-#include <gdk/gdkkeysyms.h>
 
 // ----------------------------------------------------------------------------
 // helpers
@@ -1846,7 +1844,10 @@ void wxTextCtrl::Freeze()
                               G_CALLBACK (gtk_text_exposed_callback), this);
             gtk_widget_set_sensitive(m_widget, false);
             g_object_ref(m_buffer);
-            gtk_text_view_set_buffer(GTK_TEXT_VIEW(m_text), gtk_text_buffer_new(NULL));
+            GtkTextBuffer* buf_new = gtk_text_buffer_new(NULL);
+            gtk_text_view_set_buffer(GTK_TEXT_VIEW(m_text), buf_new);
+            // gtk_text_view_set_buffer adds its own reference
+            g_object_unref(buf_new);
         }
     }
 }