don't crash in SetBackgroundStyle() if the window is not realized
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46653 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -3962,11 +3962,16 @@ bool wxWindowGTK::SetBackgroundStyle(wxBackgroundStyle style)
|
|||||||
|
|
||||||
if (style == wxBG_STYLE_CUSTOM)
|
if (style == wxBG_STYLE_CUSTOM)
|
||||||
{
|
{
|
||||||
GdkWindow *window = (GdkWindow*) NULL;
|
GdkWindow *window;
|
||||||
if (m_wxwindow)
|
if ( m_wxwindow )
|
||||||
|
{
|
||||||
window = GTK_PIZZA(m_wxwindow)->bin_window;
|
window = GTK_PIZZA(m_wxwindow)->bin_window;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
window = GetConnectWidget()->window;
|
{
|
||||||
|
GtkWidget * const w = GetConnectWidget();
|
||||||
|
window = w ? w->window : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (window)
|
if (window)
|
||||||
{
|
{
|
||||||
@@ -3979,9 +3984,11 @@ bool wxWindowGTK::SetBackgroundStyle(wxBackgroundStyle style)
|
|||||||
#endif
|
#endif
|
||||||
m_needsStyleChange = false;
|
m_needsStyleChange = false;
|
||||||
}
|
}
|
||||||
else
|
else // window not realized yet
|
||||||
|
{
|
||||||
// Do in OnIdle, because the window is not yet available
|
// Do in OnIdle, because the window is not yet available
|
||||||
m_needsStyleChange = true;
|
m_needsStyleChange = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Don't apply widget style, or we get a grey background
|
// Don't apply widget style, or we get a grey background
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user