Avoid creating empty bitmap in MSW wxNotebook::OnPaint()
It can apparently happen that the window has 0 size and in this creating the bitmap is useless and just triggers an assert. Closes #18879.
This commit is contained in:
@@ -787,11 +787,13 @@ void wxNotebook::OnEraseBackground(wxEraseEvent& WXUNUSED(event))
|
||||
void wxNotebook::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
wxMemoryDC memdc;
|
||||
RECT rc;
|
||||
::GetClientRect(GetHwnd(), &rc);
|
||||
if ( !rc.right || !rc.bottom )
|
||||
return;
|
||||
|
||||
wxBitmap bmp(rc.right, rc.bottom);
|
||||
memdc.SelectObject(bmp);
|
||||
wxMemoryDC memdc(bmp);
|
||||
|
||||
const wxLayoutDirection dir = dc.GetLayoutDirection();
|
||||
memdc.SetLayoutDirection(dir);
|
||||
|
Reference in New Issue
Block a user