Menu

#340 Crash if TDialog::Create fails in debug mode

6.34.11
closed
1
2016-08-01
2016-07-10
No

In debug mode, with __WARN defined, the WARNX statement in TDialog::Create will crash when GetHandle returns 0, which it does in case of dialog creation failure:

:::C++
  WARNX(OwlWin, !GetHandle(), 0, _T("CreateDialog[Indirect]Param failed: ") <<
    _T("Class: \"") << tstring(GetClassName()).c_str() << _T("\", ") <<
    _T("Title: \"") << tstring(Title).c_str() << _T("\", ") <<
    _T("Parent: ") << (Parent ? static_cast<void*>(Parent->GetHandle()) : 0) << _T(", ") <<
    _T("Module: \"") << GetModule()->GetModuleFileName());


The reason is that TDialog::GetClassName does not return a valid string pointer, causing the tstring constructor to fail. TDialog::GetClassName returns WC_DIALOG, which is defined as MAKEINTATOM(0x8002). This value is an atom table key disguised as an string pointer. See About Atom Tables at MSDN. In short, the return value from GetClassName can not generally be used as a string pointer, as it is here.

Related

Bugs: #348
Bugs: #349
Feature Requests: #170
Wiki: OWLNext_Stable_Releases

Discussion

  • Vidar Hasfjord

    Vidar Hasfjord - 2016-07-10
    • status: open --> pending
    • Group: unspecified --> 6.34.11


    This issue was fixed in [r3383], and the fix was merged into Owlet [r3384], 6.42 [r3385] and 6.34 [r3386].

    Resolution: The WARNX statement was simplified to now log just the string "TDialog::Create failed".

     

    Related

    Commit: [r3383]
    Commit: [r3384]
    Commit: [r3385]
    Commit: [r3386]


    Last edit: Vidar Hasfjord 2016-08-01
  • Vidar Hasfjord

    Vidar Hasfjord - 2016-08-01
    • Status: pending --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB