From: Vadim Zeitlin Date: Sat, 7 Apr 2007 23:14:58 +0000 (+0000) Subject: don't use invalid wxIconBundles, it results in asserts after recent changes X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/54eaf0c8b211a12764c668dc4b8819382ebbaa68 don't use invalid wxIconBundles, it results in asserts after recent changes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45319 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/gtk1/toplevel.cpp b/src/gtk1/toplevel.cpp index fa58734334..97c4fc09c6 100644 --- a/src/gtk1/toplevel.cpp +++ b/src/gtk1/toplevel.cpp @@ -327,7 +327,7 @@ gtk_frame_realized_callback( GtkWidget * WXUNUSED(widget), // reset the icon wxIconBundle iconsOld = win->GetIcons(); - if ( iconsOld.GetIcon(-1).Ok() ) + if ( !iconsOld.IsEmpty() ) { win->SetIcon( wxNullIcon ); win->SetIcons( iconsOld ); @@ -1088,7 +1088,13 @@ void wxTopLevelWindowGTK::SetTitle( const wxString &title ) void wxTopLevelWindowGTK::SetIcon( const wxIcon &icon ) { - SetIcons( wxIconBundle( icon ) ); + // passing wxNullIcon to SetIcon() is possible (it means that we shouldn't + // have any icon), but adding an invalid icon to wxIconBundle is not + wxIconBundle icons; + if ( icon.Ok() ) + icons.AddIcon(icon); + + SetIcons(icons); } void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons ) @@ -1097,6 +1103,9 @@ void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons ) wxTopLevelWindowBase::SetIcons( icons ); + if ( icons.IsEmpty() ) + return; + GdkWindow* window = m_widget->window; if (!window) return;