Merge branch 'qt_fix_button_crash' of https://github.com/GeoTeric/wxWidgets

Fix crashes when loading wxButton from XRC in wxQt

See https://github.com/wxWidgets/wxWidgets/pull/1091
This commit is contained in:
Vadim Zeitlin 2018-12-20 20:00:39 +01:00
commit 54f96392be
2 changed files with 12 additions and 5 deletions

View File

@ -18,9 +18,7 @@ class QPushButton;
class WXDLLIMPEXP_CORE wxAnyButton : public wxAnyButtonBase
{
public:
wxAnyButton()
{
}
wxAnyButton();
// implementation
// --------------

View File

@ -46,6 +46,12 @@ void wxQtPushButton::clicked( bool WXUNUSED(checked) )
}
}
wxAnyButton::wxAnyButton() :
m_qtPushButton(NULL)
{
}
void wxAnyButton::QtCreate(wxWindow *parent)
{
// create the default push button (used in button and bmp button)
@ -56,8 +62,11 @@ void wxAnyButton::QtSetBitmap( const wxBitmap &bitmap )
{
// load the bitmap and resize the button:
QPixmap *pixmap = bitmap.GetHandle();
m_qtPushButton->setIcon( QIcon( *pixmap ));
m_qtPushButton->setIconSize( pixmap->rect().size() );
if ( pixmap != NULL )
{
m_qtPushButton->setIcon(QIcon(*pixmap));
m_qtPushButton->setIconSize(pixmap->rect().size());
}
m_bitmap = bitmap;
}