fix for GTK assertion `info->icon_pixmap == NULL' failed, #9905

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55274 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett 2008-08-26 05:10:45 +00:00
parent 2f663107ff
commit 0617ba3e34

View File

@ -317,13 +317,9 @@ gtk_frame_realized_callback( GtkWidget * WXUNUSED(widget),
else else
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1); gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
// reset the icon const wxIconBundle& icons = win->GetIcons();
wxIconBundle iconsOld = win->GetIcons(); if (icons.GetIconCount())
if ( !iconsOld.IsEmpty() ) win->SetIcons(icons);
{
win->SetIcon( wxNullIcon );
win->SetIcons( iconsOld );
}
if (win->HasFlag(wxFRAME_SHAPED)) if (win->HasFlag(wxFRAME_SHAPED))
win->SetShape(win->m_shape); // it will really set the window shape now win->SetShape(win->m_shape); // it will really set the window shape now
@ -1101,16 +1097,17 @@ void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons )
wxTopLevelWindowBase::SetIcons( icons ); wxTopLevelWindowBase::SetIcons( icons );
GList *list = NULL; // Setting icons before window is realized can cause a GTK assertion if
// another TLW is realized before this one, and it has this one as it's
const size_t numIcons = icons.GetIconCount(); // transient parent. The life demo exibits this problem.
for ( size_t i = 0; i < numIcons; i++ ) //if (GTK_WIDGET_REALIZED(m_widget))
{ {
list = g_list_prepend(list, icons.GetIconByIndex(i).GetPixbuf()); GList* list = NULL;
for (size_t i = icons.GetIconCount(); i--;)
list = g_list_prepend(list, icons.GetIconByIndex(i).GetPixbuf());
gtk_window_set_icon_list(GTK_WINDOW(m_widget), list);
g_list_free(list);
} }
gtk_window_set_icon_list(GTK_WINDOW(m_widget), list);
g_list_free(list);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------