gtk_widget_destroy does not unref the widget unless it's a TLW or in a
container, so use gtk_object_sink to delete temporary, parentless widgets. Fixes memory leak bug #1741184. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@46605 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -28,8 +28,11 @@
|
|||||||
#include "wx/module.h"
|
#include "wx/module.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/gtk/private.h"
|
#include <gtk/gtkversion.h>
|
||||||
|
#if GTK_CHECK_VERSION(2, 9, 0)
|
||||||
|
// gtk_object_sink
|
||||||
|
#undef GTK_DISABLE_DEPRECATED
|
||||||
|
#endif
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
// compatibility with older GTK+ versions:
|
// compatibility with older GTK+ versions:
|
||||||
@@ -211,7 +214,7 @@ static GdkPixbuf *CreateStockIcon(const char *stockid, GtkIconSize size)
|
|||||||
gs_gtkStyle = gtk_rc_get_style(widget);
|
gs_gtkStyle = gtk_rc_get_style(widget);
|
||||||
wxASSERT( gs_gtkStyle != NULL );
|
wxASSERT( gs_gtkStyle != NULL );
|
||||||
g_object_ref(gs_gtkStyle);
|
g_object_ref(gs_gtkStyle);
|
||||||
gtk_widget_destroy(widget);
|
gtk_object_sink((GtkObject*)widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkIconSet *iconset = gtk_style_lookup_icon_set(gs_gtkStyle, stockid);
|
GtkIconSet *iconset = gtk_style_lookup_icon_set(gs_gtkStyle, stockid);
|
||||||
|
@@ -126,7 +126,7 @@ static bool GetColourFromGTKWidget(GdkColor& gdkColor,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_destroy( widget );
|
gtk_object_sink((GtkObject*)widget);
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
@@ -140,14 +140,7 @@ static void GetTooltipColors()
|
|||||||
gs_objects.m_colTooltip = wxColor(c);
|
gs_objects.m_colTooltip = wxColor(c);
|
||||||
c = tooltips->tip_window->style->fg[GTK_STATE_NORMAL];
|
c = tooltips->tip_window->style->fg[GTK_STATE_NORMAL];
|
||||||
gs_objects.m_colTooltipText = wxColor(c);
|
gs_objects.m_colTooltipText = wxColor(c);
|
||||||
#if GTK_CHECK_VERSION(2, 9, 0)
|
gtk_object_sink((GtkObject*)tooltips);
|
||||||
if (gtk_check_version(2, 9, 0) == NULL)
|
|
||||||
g_object_ref_sink(tooltips);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
gtk_object_sink((GtkObject*)tooltips);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxColour wxSystemSettingsNative::GetColour( wxSystemColour index )
|
wxColour wxSystemSettingsNative::GetColour( wxSystemColour index )
|
||||||
@@ -355,7 +348,7 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index )
|
|||||||
gs_objects.m_fontSystem = wxFont(wxString::FromAscii(font_name));
|
gs_objects.m_fontSystem = wxFont(wxString::FromAscii(font_name));
|
||||||
g_free (font_name);
|
g_free (font_name);
|
||||||
}
|
}
|
||||||
gtk_widget_destroy( widget );
|
gtk_object_sink((GtkObject*)widget);
|
||||||
}
|
}
|
||||||
font = gs_objects.m_fontSystem;
|
font = gs_objects.m_fontSystem;
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user