Fix crashes due to unitialised fields

This commit is contained in:
Graham Dawes
2018-12-20 10:38:50 +00:00
parent c6d3b9c0b9
commit bfb59228c1
20 changed files with 46 additions and 19 deletions

View File

@@ -20,6 +20,8 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxApp, wxAppBase);
wxApp::wxApp() wxApp::wxApp()
{ {
m_qtApplication = NULL; m_qtApplication = NULL;
m_qtArgc = 0;
m_qtArgv = NULL;
} }

View File

@@ -46,7 +46,8 @@ void wxQtCheckBox::clicked( bool checked )
} }
wxCheckBox::wxCheckBox() wxCheckBox::wxCheckBox() :
m_qtCheckBox(NULL)
{ {
} }

View File

@@ -37,7 +37,8 @@ void wxQtChoice::activated(int WXUNUSED(index))
} }
wxChoice::wxChoice() wxChoice::wxChoice() :
m_qtComboBox(NULL)
{ {
} }

View File

@@ -112,8 +112,9 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
const wxValidator& validator, const wxValidator& validator,
const wxString& name ) const wxString& name )
{ {
return Create( parent, id, value, pos, size, choices.size(), &choices[ 0 ], const wxString *pChoices = choices.size() ? &choices[ 0 ] : NULL;
style, validator, name ); return Create(parent, id, value, pos, size, choices.size(), pChoices,
style, validator, name );
} }

View File

@@ -29,7 +29,8 @@ wxQtProgressBar::wxQtProgressBar( wxWindow *parent, wxGauge *handler )
} }
wxGauge::wxGauge() wxGauge::wxGauge() :
m_qtProgressBar(NULL)
{ {
} }

View File

@@ -45,7 +45,8 @@ void wxQtListWidget::doubleClicked( const QModelIndex &index )
} }
wxListBox::wxListBox() wxListBox::wxListBox() :
m_qtListWidget(NULL)
{ {
Init(); Init();
} }

View File

@@ -154,6 +154,7 @@ void wxListCtrl::Init()
m_ownsImageListSmall = false; m_ownsImageListSmall = false;
m_imageListState = NULL; m_imageListState = NULL;
m_ownsImageListState = false; m_ownsImageListState = false;
m_qtTreeWidget = NULL;
} }
wxListCtrl::~wxListCtrl() wxListCtrl::~wxListCtrl()

View File

@@ -50,7 +50,8 @@ void wxQtTabWidget::currentChanged(int index)
} }
wxNotebook::wxNotebook() wxNotebook::wxNotebook() :
m_qtTabWidget(NULL)
{ {
} }

View File

@@ -56,7 +56,10 @@ void wxQtButtonGroup::buttonClicked(int index) {
wxIMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl); wxIMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl);
wxRadioBox::wxRadioBox() wxRadioBox::wxRadioBox() :
m_qtGroupBox(NULL),
m_qtButtonGroup(NULL),
m_qtBoxLayout(NULL)
{ {
} }
@@ -149,7 +152,7 @@ bool wxRadioBox::Create(wxWindow *parent,
// GetMajorDim() is the number of rows. // GetMajorDim() is the number of rows.
if ( style & wxRA_SPECIFY_COLS ) if ( style & wxRA_SPECIFY_COLS )
m_qtBoxLayout = new QHBoxLayout; m_qtBoxLayout = new QHBoxLayout;
else if ( style & wxRA_SPECIFY_ROWS ) else
m_qtBoxLayout = new QVBoxLayout; m_qtBoxLayout = new QVBoxLayout;
AddChoices< QRadioButton >( m_qtButtonGroup, m_qtBoxLayout, n, choices ); AddChoices< QRadioButton >( m_qtButtonGroup, m_qtBoxLayout, n, choices );
@@ -242,6 +245,9 @@ bool wxRadioBox::Show(unsigned int n, bool show)
bool wxRadioBox::Show( bool show ) bool wxRadioBox::Show( bool show )
{ {
if (!m_qtGroupBox)
return false;
if( m_qtGroupBox->isVisible() == show ) if( m_qtGroupBox->isVisible() == show )
{ {
for( unsigned int i = 0; i < GetCount(); ++i ) for( unsigned int i = 0; i < GetCount(); ++i )

View File

@@ -13,7 +13,8 @@
#include <QtWidgets/QRadioButton> #include <QtWidgets/QRadioButton>
wxRadioButton::wxRadioButton() wxRadioButton::wxRadioButton() :
m_qtRadioButton(NULL)
{ {
} }

View File

@@ -27,7 +27,8 @@ class wxQtScrollBar : public wxQtEventSignalHandler< QScrollBar, wxScrollBar >
}; };
wxScrollBar::wxScrollBar() wxScrollBar::wxScrollBar() :
m_qtScrollBar(NULL)
{ {
} }

View File

@@ -46,7 +46,8 @@ void wxQtSlider::valueChanged(int position)
} }
wxSlider::wxSlider() wxSlider::wxSlider() :
m_qtSlider(NULL)
{ {
} }

View File

@@ -41,7 +41,8 @@ void wxQtSpinButton::valueChanged(int value)
} }
wxSpinButton::wxSpinButton() wxSpinButton::wxSpinButton() :
m_qtSpinBox(NULL)
{ {
} }

View File

@@ -18,7 +18,8 @@
#include <QtWidgets/QSpinBox> #include <QtWidgets/QSpinBox>
template< typename T, typename Widget > template< typename T, typename Widget >
wxSpinCtrlQt< T, Widget >::wxSpinCtrlQt() wxSpinCtrlQt< T, Widget >::wxSpinCtrlQt() :
m_qtSpinBox(NULL)
{ {
} }

View File

@@ -21,7 +21,8 @@ public:
}; };
wxStaticBitmap::wxStaticBitmap() wxStaticBitmap::wxStaticBitmap() :
m_qtLabel(NULL)
{ {
} }

View File

@@ -23,7 +23,8 @@ public:
}; };
wxStaticBox::wxStaticBox() wxStaticBox::wxStaticBox() :
m_qtGroupBox(NULL)
{ {
} }

View File

@@ -12,7 +12,8 @@
#include <QtWidgets/QFrame> #include <QtWidgets/QFrame>
wxStaticLine::wxStaticLine() wxStaticLine::wxStaticLine() :
m_qtFrame(NULL)
{ {
} }

View File

@@ -22,7 +22,8 @@ public:
}; };
wxStaticText::wxStaticText() wxStaticText::wxStaticText() :
m_qtLabel(NULL)
{ {
} }

View File

@@ -105,6 +105,7 @@ void wxStatusBar::Refresh( bool eraseBackground, const wxRect *rect )
void wxStatusBar::Init() void wxStatusBar::Init()
{ {
m_qtStatusBar = NULL;
m_qtPanes = NULL; m_qtPanes = NULL;
} }

View File

@@ -90,7 +90,9 @@ void wxQtTextEdit::textChanged()
} }
wxTextCtrl::wxTextCtrl() wxTextCtrl::wxTextCtrl() :
m_qtLineEdit(NULL),
m_qtTextEdit(NULL)
{ {
} }