don't crash trying to draw buttons with invalid bitmaps (the real fix would be to avoid adding them to the toolbar in the first place, of course...)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56666 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-11-03 17:24:51 +00:00
parent 6f23f80b72
commit 57c6f0fe5f

View File

@@ -691,26 +691,26 @@ void wxToolBar::DoDraw(wxControlRenderer *renderer)
{
label = tool->GetLabel();
bitmap = tool->GetBitmap();
if ( !bitmap.IsOk() )
{
// it's better not to draw anything than to assert inside
// drawing code as this results in an almost guaranteed crash
// as we're likely to be called by a paint event handler and so
// the assert is going to be triggered again and again and ...
continue;
}
}
//else: leave both the label and the bitmap invalid to draw a separator
if ( !tool->IsControl() )
{
int tbStyle = 0;
if(HasFlag(wxTB_TEXT))
{
int tbStyle = HasFlag(wxTB_VERTICAL) ? wxTB_VERTICAL : wxTB_HORIZONTAL;
if ( HasFlag(wxTB_TEXT) )
tbStyle |= wxTB_TEXT;
}
if(HasFlag(wxTB_VERTICAL))
{
tbStyle |= wxTB_VERTICAL;
}
else
{
tbStyle |= wxTB_HORIZONTAL;
}
rend->DrawToolBarButton(dc, label, bitmap, rectTool, flags, tool->GetStyle(), tbStyle);
rend->DrawToolBarButton(dc, label, bitmap, rectTool, flags,
tool->GetStyle(), tbStyle);
}
else // control
{