Fix bug with using uninitialized flags in GetParentForModalDialog().
GetParentForModalDialog() was called from the ctor initialized list before m_windowStyle could be initialized by the base class ctor in several different places, meaning that the check for wxDIALOG_NO_PARENT in this function was using uninitialized variable. Fix this by passing the style parameter explicitly to this function to allow using it from derived class ctors. Still keep an overload which uses the actual window parent and flags which is simpler to use for later calls to this function. Thanks valgrind for finding this one. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64019 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -98,8 +98,19 @@ public:
|
||||
// but fall back to the current active window or main application window as
|
||||
// last resort if it is unsuitable.
|
||||
//
|
||||
// As this function is often called from the ctor, the window style may be
|
||||
// not set yet and hence must be passed explicitly to it so that we could
|
||||
// check whether it contains wxDIALOG_NO_PARENT bit.
|
||||
//
|
||||
// This function always returns a valid top level window or NULL.
|
||||
wxWindow *GetParentForModalDialog(wxWindow *parent = NULL) const;
|
||||
wxWindow *GetParentForModalDialog(wxWindow *parent, long style) const;
|
||||
|
||||
// This overload can only be used for already initialized windows, i.e. not
|
||||
// from the ctor. It uses the current window parent and style.
|
||||
wxWindow *GetParentForModalDialog() const
|
||||
{
|
||||
return GetParentForModalDialog(GetParent(), GetWindowStyle());
|
||||
}
|
||||
|
||||
#if wxUSE_STATTEXT // && wxUSE_TEXTCTRL
|
||||
// splits text up at newlines and places the
|
||||
|
Reference in New Issue
Block a user