hack to fix crash when creating a DC for a widgetless window
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6105 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -126,6 +126,15 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
|||||||
|
|
||||||
GtkWidget *widget = window->m_wxwindow;
|
GtkWidget *widget = window->m_wxwindow;
|
||||||
|
|
||||||
|
// some controls don't have m_wxwindow - like wxStaticBox, but the user
|
||||||
|
// code should still be able to create wxClientDCs for them, so we will
|
||||||
|
// use the parent window here then
|
||||||
|
if ( !widget )
|
||||||
|
{
|
||||||
|
window = window->GetParent();
|
||||||
|
widget = window->m_wxwindow;
|
||||||
|
}
|
||||||
|
|
||||||
wxASSERT_MSG( widget, wxT("DC needs a widget") );
|
wxASSERT_MSG( widget, wxT("DC needs a widget") );
|
||||||
|
|
||||||
GtkPizza *pizza = GTK_PIZZA( widget );
|
GtkPizza *pizza = GTK_PIZZA( widget );
|
||||||
@@ -140,10 +149,7 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->m_wxwindow)
|
m_cmap = gtk_widget_get_colormap( widget ? widget : window->m_widget );
|
||||||
m_cmap = gtk_widget_get_colormap( window->m_wxwindow );
|
|
||||||
else
|
|
||||||
m_cmap = gtk_widget_get_colormap( window->m_widget );
|
|
||||||
|
|
||||||
SetUpDC();
|
SetUpDC();
|
||||||
|
|
||||||
|
@@ -126,6 +126,15 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
|||||||
|
|
||||||
GtkWidget *widget = window->m_wxwindow;
|
GtkWidget *widget = window->m_wxwindow;
|
||||||
|
|
||||||
|
// some controls don't have m_wxwindow - like wxStaticBox, but the user
|
||||||
|
// code should still be able to create wxClientDCs for them, so we will
|
||||||
|
// use the parent window here then
|
||||||
|
if ( !widget )
|
||||||
|
{
|
||||||
|
window = window->GetParent();
|
||||||
|
widget = window->m_wxwindow;
|
||||||
|
}
|
||||||
|
|
||||||
wxASSERT_MSG( widget, wxT("DC needs a widget") );
|
wxASSERT_MSG( widget, wxT("DC needs a widget") );
|
||||||
|
|
||||||
GtkPizza *pizza = GTK_PIZZA( widget );
|
GtkPizza *pizza = GTK_PIZZA( widget );
|
||||||
@@ -140,10 +149,7 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->m_wxwindow)
|
m_cmap = gtk_widget_get_colormap( widget ? widget : window->m_widget );
|
||||||
m_cmap = gtk_widget_get_colormap( window->m_wxwindow );
|
|
||||||
else
|
|
||||||
m_cmap = gtk_widget_get_colormap( window->m_widget );
|
|
||||||
|
|
||||||
SetUpDC();
|
SetUpDC();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user