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:
@@ -691,26 +691,26 @@ void wxToolBar::DoDraw(wxControlRenderer *renderer)
|
|||||||
{
|
{
|
||||||
label = tool->GetLabel();
|
label = tool->GetLabel();
|
||||||
bitmap = tool->GetBitmap();
|
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
|
//else: leave both the label and the bitmap invalid to draw a separator
|
||||||
|
|
||||||
if ( !tool->IsControl() )
|
if ( !tool->IsControl() )
|
||||||
{
|
{
|
||||||
int tbStyle = 0;
|
int tbStyle = HasFlag(wxTB_VERTICAL) ? wxTB_VERTICAL : wxTB_HORIZONTAL;
|
||||||
if(HasFlag(wxTB_TEXT))
|
if ( HasFlag(wxTB_TEXT) )
|
||||||
{
|
|
||||||
tbStyle |= wxTB_TEXT;
|
tbStyle |= wxTB_TEXT;
|
||||||
}
|
|
||||||
|
|
||||||
if(HasFlag(wxTB_VERTICAL))
|
rend->DrawToolBarButton(dc, label, bitmap, rectTool, flags,
|
||||||
{
|
tool->GetStyle(), tbStyle);
|
||||||
tbStyle |= wxTB_VERTICAL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tbStyle |= wxTB_HORIZONTAL;
|
|
||||||
}
|
|
||||||
rend->DrawToolBarButton(dc, label, bitmap, rectTool, flags, tool->GetStyle(), tbStyle);
|
|
||||||
}
|
}
|
||||||
else // control
|
else // control
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user