Avoid binding reference to NULL pointer when wxUSE_VALIDATORS==0
Undefined behavior sanitizer complains about it
This commit is contained in:
@@ -97,8 +97,6 @@ private:
|
|||||||
wxDECLARE_NO_ASSIGN_CLASS(wxValidator);
|
wxDECLARE_NO_ASSIGN_CLASS(wxValidator);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern WXDLLIMPEXP_DATA_CORE(const wxValidator) wxDefaultValidator;
|
|
||||||
|
|
||||||
#define wxVALIDATOR_PARAM(val) val
|
#define wxVALIDATOR_PARAM(val) val
|
||||||
|
|
||||||
#else // !wxUSE_VALIDATORS
|
#else // !wxUSE_VALIDATORS
|
||||||
@@ -107,13 +105,13 @@ extern WXDLLIMPEXP_DATA_CORE(const wxValidator) wxDefaultValidator;
|
|||||||
// a wxValidator parameter to avoid using "#if wxUSE_VALIDATORS"
|
// a wxValidator parameter to avoid using "#if wxUSE_VALIDATORS"
|
||||||
// everywhere
|
// everywhere
|
||||||
class WXDLLIMPEXP_FWD_CORE wxValidator;
|
class WXDLLIMPEXP_FWD_CORE wxValidator;
|
||||||
static const wxValidator* const wxDefaultValidatorPtr = NULL;
|
|
||||||
#define wxDefaultValidator (*wxDefaultValidatorPtr)
|
|
||||||
|
|
||||||
// this macro allows to avoid warnings about unused parameters when
|
// this macro allows to avoid warnings about unused parameters when
|
||||||
// wxUSE_VALIDATORS == 0
|
// wxUSE_VALIDATORS == 0
|
||||||
#define wxVALIDATOR_PARAM(val)
|
#define wxVALIDATOR_PARAM(val)
|
||||||
#endif // wxUSE_VALIDATORS/!wxUSE_VALIDATORS
|
#endif // wxUSE_VALIDATORS/!wxUSE_VALIDATORS
|
||||||
|
|
||||||
|
extern WXDLLIMPEXP_DATA_CORE(const wxValidator) wxDefaultValidator;
|
||||||
|
|
||||||
#endif // _WX_VALIDATE_H_
|
#endif // _WX_VALIDATE_H_
|
||||||
|
|
||||||
|
@@ -23,8 +23,6 @@
|
|||||||
#include "wx/window.h"
|
#include "wx/window.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const wxValidator wxDefaultValidator;
|
|
||||||
|
|
||||||
wxIMPLEMENT_DYNAMIC_CLASS(wxValidator, wxEvtHandler);
|
wxIMPLEMENT_DYNAMIC_CLASS(wxValidator, wxEvtHandler);
|
||||||
|
|
||||||
// VZ: personally, I think true would be more appropriate - these bells are
|
// VZ: personally, I think true would be more appropriate - these bells are
|
||||||
@@ -39,6 +37,10 @@ wxValidator::wxValidator()
|
|||||||
wxValidator::~wxValidator()
|
wxValidator::~wxValidator()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
#endif
|
class WXDLLIMPEXP_CORE wxValidator { };
|
||||||
// wxUSE_VALIDATORS
|
|
||||||
|
#endif // wxUSE_VALIDATORS
|
||||||
|
|
||||||
|
const wxValidator wxDefaultValidator;
|
||||||
|
Reference in New Issue
Block a user