wxASSERT if first wxView::OnCreate() fails (Issue #25003)

10 views
Skip to first unread message

Bill Su

unread,
Dec 14, 2024, 2:24:51 AM (7 days ago) Dec 14
to wx-...@googlegroups.com, Subscribed

Description

Bug description:

If a docview application has no open documents, and (overridden) wxView::OnCreate() returns false, then the wxView will be deleted, but during the wxView cleanup, a wxASSERT in wxView::TryBefore() will fail.

Expected vs observed behaviour:

No wxASSERT failure

Stack trace:

 	wxbase330ud_vc_x64_cyberboard.dll!wxOnAssert(const char * file, int line, const char * func, const char * cond, const char * msg) Line 1213	C++
>	wxmsw330ud_core_vc_x64_cyberboard.dll!wxView::TryBefore(wxEvent & event) Line 774	C++
 	wxbase330ud_vc_x64_cyberboard.dll!wxEvtHandler::TryBeforeAndHere(wxEvent & event) Line 3989	C++
 	wxbase330ud_vc_x64_cyberboard.dll!wxEvtHandler::ProcessEventLocally(wxEvent & event) Line 1576	C++
 	wxmsw330ud_core_vc_x64_cyberboard.dll!wxDocManager::TryBefore(wxEvent & event) Line 1446	C++
 	wxbase330ud_vc_x64_cyberboard.dll!wxEvtHandler::TryBeforeAndHere(wxEvent & event) Line 3989	C++
 	wxbase330ud_vc_x64_cyberboard.dll!wxEvtHandler::ProcessEventLocally(wxEvent & event) Line 1576	C++
 	wxmsw330ud_core_vc_x64_cyberboard.dll!wxDocParentFrameAnyBase::TryProcessEvent(wxEvent & event) Line 2154	C++
 	docview.exe!wxDocParentFrameAny<wxAuiMDIParentFrame>::TryBefore(wxEvent & event) Line 876	C++
 	wxbase330ud_vc_x64_cyberboard.dll!wxEvtHandler::TryBeforeAndHere(wxEvent & event) Line 3989	C++
 	wxbase330ud_vc_x64_cyberboard.dll!wxEvtHandler::ProcessEventLocally(wxEvent & event) Line 1576	C++
 	wxbase330ud_vc_x64_cyberboard.dll!wxEvtHandler::ProcessEvent(wxEvent & event) Line 1549	C++
 	wxmsw330ud_aui_vc_x64_cyberboard.dll!wxAuiMDIParentFrame::ProcessEvent(wxEvent & event) Line 234	C++
 	wxbase330ud_vc_x64_cyberboard.dll!wxEvtHandler::SafelyProcessEvent(wxEvent & event) Line 1665	C++
 	wxmsw330ud_core_vc_x64_cyberboard.dll!wxWindowBase::HandleWindowEvent(wxEvent & event) Line 1511	C++
 	wxmsw330ud_core_vc_x64_cyberboard.dll!wxWindow::HandleEraseBkgnd(HDC__ * hdc) Line 5527	C++
 	wxmsw330ud_core_vc_x64_cyberboard.dll!wxWindow::MSWHandleMessage(__int64 * result, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 3677	C++
 	wxmsw330ud_core_vc_x64_cyberboard.dll!wxWindow::MSWWindowProc(unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 4037	C++
 	wxmsw330ud_core_vc_x64_cyberboard.dll!wxNonOwnedWindow::MSWWindowProc(unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 261	C++
 	wxmsw330ud_core_vc_x64_cyberboard.dll!wxTopLevelWindowMSW::MSWWindowProc(unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 325	C++
 	wxmsw330ud_core_vc_x64_cyberboard.dll!wxFrame::MSWWindowProc(unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 924	C++
 	wxmsw330ud_core_vc_x64_cyberboard.dll!wxWndProc(HWND__ * hWnd, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 3083	C++
 	user32.dll!00007ffe0c28ef5c()	Unknown
 	user32.dll!00007ffe0c28e8cc()	Unknown
 	user32.dll!00007ffe0c2a10c3()	Unknown
 	ntdll.dll!00007ffe0cef1374()	Unknown
 	win32u.dll!00007ffe0a901464()	Unknown
 	wxmsw330ud_core_vc_x64_cyberboard.dll!wxMenuBar::Refresh() Line 914	C++
 	wxmsw330ud_core_vc_x64_cyberboard.dll!wxMenuBar::Remove(unsigned __int64 pos) Line 1212	C++
 	wxmsw330ud_aui_vc_x64_cyberboard.dll!wxAuiMDIParentFrame::RemoveWindowMenu(wxMenuBar * pMenuBar) Line 337	C++
 	wxmsw330ud_aui_vc_x64_cyberboard.dll!wxAuiMDIParentFrame::SetMenuBar(wxMenuBar * pMenuBar) Line 170	C++
 	wxmsw330ud_aui_vc_x64_cyberboard.dll!wxAuiMDIParentFrame::SetChildMenuBar(wxAuiMDIChildFrame * pChild) Line 184	C++
 	wxmsw330ud_aui_vc_x64_cyberboard.dll!wxAuiMDIChildFrame::Destroy() Line 558	C++
 	wxmsw330ud_core_vc_x64_cyberboard.dll!wxView::~wxView() Line 759	C++
 	docview.exe!DrawingView::~DrawingView()	C++
 	docview.exe!DrawingView::`scalar deleting destructor'(unsigned int)	C++
 	wxmsw330ud_core_vc_x64_cyberboard.dll!std::default_delete<wxView>::operator()(wxView * _Ptr) Line 3302	C++
 	wxmsw330ud_core_vc_x64_cyberboard.dll!std::unique_ptr<wxView,std::default_delete<wxView>>::~unique_ptr<wxView,std::default_delete<wxView>>() Line 3412	C++
 	wxmsw330ud_core_vc_x64_cyberboard.dll!wxDocTemplate::CreateView(wxDocument * doc, long flags) Line 935	C++
 	wxmsw330ud_core_vc_x64_cyberboard.dll!wxDocument::OnCreate(const wxString & __formal, long flags) Line 614	C++
 	wxmsw330ud_core_vc_x64_cyberboard.dll!wxDocTemplate::InitDocument(wxDocument * doc, const wxString & path, long flags) Line 906	C++
 	wxmsw330ud_core_vc_x64_cyberboard.dll!wxDocTemplate::CreateDocument(const wxString & path, long flags) Line 893	C++
 	wxmsw330ud_core_vc_x64_cyberboard.dll!wxDocManager::CreateDocument(const wxString & pathOrig, long flags) Line 1572	C++
 	wxmsw330ud_core_vc_x64_cyberboard.dll!wxDocManager::CreateNewDocument() Line 430	C++
 	docview.exe!MyApp::OnInit() Line 290	C++
 	wxbase330ud_vc_x64_cyberboard.dll!wxAppConsoleBase::CallOnInit() Line 92	C++
 	wxbase330ud_vc_x64_cyberboard.dll!wxEntryReal(int & argc, wchar_t * * argv) Line 559	C++
 	wxbase330ud_vc_x64_cyberboard.dll!wxEntry(int & argc, wchar_t * * argv) Line 171	C++
 	wxmsw330ud_core_vc_x64_cyberboard.dll!wxEntry(HINSTANCE__ * hInstance, HINSTANCE__ * __formal, char * __formal, int nCmdShow) Line 232	C++
 	docview.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow) Line 74	C++
 	docview.exe!invoke_main() Line 107	C++
 	docview.exe!__scrt_common_main_seh() Line 288	C++
 	docview.exe!__scrt_common_main() Line 331	C++
 	docview.exe!WinMainCRTStartup(void * __formal) Line 17	C++
 	kernel32.dll!00007ffe0b0e7374()	Unknown
 	ntdll.dll!00007ffe0ce9cc91()	Unknown

Patch or snippet allowing to reproduce the problem:

wxview-oncreate-failure.patch

To Reproduce:

  1. Apply the attached patch to the docview sample
  2. Run the docview sample
  3. Select the Drawing template
  4. Hit OK
    -->
    wxASSERT fails

Platform and version information

  • wxWidgets version you use: master ~ 2024/10/08
  • wxWidgets port you use: wxMSW
  • OS and its version: Windows 10 22H2


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/25003@github.com>

Bill Su

unread,
Dec 14, 2024, 2:34:38 AM (7 days ago) Dec 14
to wx-...@googlegroups.com, Subscribed

I apologize. The failing wxASSERT was part of my experimentation, not committed code. I will close this issue.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/25003/2542943318@github.com>

Bill Su

unread,
Dec 14, 2024, 2:34:38 AM (7 days ago) Dec 14
to wx-...@googlegroups.com, Subscribed

Closed #25003 as not planned.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issue/25003/issue_event/15656223320@github.com>

Reply all
Reply to author
Forward
0 new messages