From: Vadim Zeitlin Date: Mon, 24 Mar 2003 19:21:08 +0000 (+0000) Subject: added a check for allowed id value (bug 690910) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/925f154dac75c30acb9b763560d55f243301c99a?ds=inline added a check for allowed id value (bug 690910) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19761 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index c58341994f..14c2493d7d 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -224,8 +224,14 @@ bool wxWindowBase::CreateBase(wxWindowBase *parent, _T("wxStaticBox can't be used as a window parent!") ); #endif // wxUSE_STATBOX + // ids are limited to 16 bits under MSW so if you care about portability, + // it's not a good idea to use ids out of this range (and negative ids are + // reserved for wxWindows own usage) + wxASSERT_MSG( id == wxID_ANY || (id >= 0 && id < 32767), + _T("invalid id value") ); + // generate a new id if the user doesn't care about it - m_windowId = id == -1 ? NewControlId() : id; + m_windowId = id == wxID_ANY ? NewControlId() : id; SetName(name); SetWindowStyleFlag(style);