"LIBDBUSMENU-GLIB-WARNING **: Trying to remove a child that doesn't believe we're it's parent."
Avoid calling gtk_widget_destroy() on a wxMenuBar attached to a frame
Fixes #14292
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71648
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
wxMenuBar();
wxMenuBar(long style);
wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0);
wxMenuBar();
wxMenuBar(long style);
wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0);
// implement base class (pure) virtuals
virtual bool Append( wxMenu *menu, const wxString &title );
// implement base class (pure) virtuals
virtual bool Append( wxMenu *menu, const wxString &title );
// wxMenuBar
//-----------------------------------------------------------------------------
// wxMenuBar
//-----------------------------------------------------------------------------
+wxMenuBar::~wxMenuBar()
+{
+ if (m_widget)
+ {
+ // Work around a probable bug in Ubuntu 12.04 which causes a warning if
+ // gtk_widget_destroy() is called on a wxMenuBar attached to a frame
+ GtkWidget* widget = m_widget;
+ m_widget = NULL;
+ g_object_unref(widget);
+ }
+}
+
void wxMenuBar::Init(size_t n, wxMenu *menus[], const wxString titles[], long style)
{
#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2
void wxMenuBar::Init(size_t n, wxMenu *menus[], const wxString titles[], long style)
{
#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2
GTKApplyWidgetStyle();
#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2/!wxUSE_LIBHILDON && !wxUSE_LIBHILDON2
GTKApplyWidgetStyle();
#endif // wxUSE_LIBHILDON || wxUSE_LIBHILDON2/!wxUSE_LIBHILDON && !wxUSE_LIBHILDON2
- g_object_ref(m_widget);
+ g_object_ref_sink(m_widget);
for (size_t i = 0; i < n; ++i )
Append(menus[i], titles[i]);
for (size_t i = 0; i < n; ++i )
Append(menus[i], titles[i]);