Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#5501 closed defect (fixed)

[ATLAS] Crash when opening system menu (globe icon) on Windows 10

Reported by: historic_bruno Owned by: historic_bruno
Priority: Must Have Milestone: Alpha 24
Component: Atlas editor Keywords:
Cc: Patch:

Description

On Windows 10, I get a crash with both Alpha 23b and latest SVN, when trying to open the system menu (top left corner, globe icon):

First-chance exception at 0x569B87D6 (AtlasUI.dll) in pyrogenesis.exe: 0xC0000005: Access violation reading location 0x00000074.
Unhandled exception at 0x569B87D6 (AtlasUI.dll) in pyrogenesis.exe: 0xC000041D: An unhandled exception was encountered during a user callback.

Call stack:

>	10420	0	Worker Thread	main
	AtlasUI.dll!wxMenuBase::FindItem	Normal
	AtlasUI.dll!wxMenuBase::FindItem(int itemId, wxMenu * * itemMenu) Line 529	 
	AtlasUI.dll!ScenarioEditor::OnMenuOpen(wxMenuEvent & event) Line 1003	 
	AtlasUI.dll!wxAppConsoleBase::HandleEvent(wxEvtHandler * handler, void (wxEvent &) * func, wxEvent & event) Line 612	 
	AtlasUI.dll!wxAppConsoleBase::CallEventHandler(wxEvtHandler * handler, wxEventFunctor & functor, wxEvent & event) Line 623	 
	AtlasUI.dll!wxEvtHandler::ProcessEventIfMatchesId(const wxEventTableEntryBase & entry, wxEvtHandler * handler, wxEvent & event) Line 1394	 
	AtlasUI.dll!wxEventHashTable::HandleEvent(wxEvent & event, wxEvtHandler * self) Line 998	 
	AtlasUI.dll!wxEvtHandler::TryHereOnly(wxEvent & event) Line 1589	 
	AtlasUI.dll!wxEvtHandler::ProcessEvent(wxEvent & event) Line 1495	 
	AtlasUI.dll!wxEvtHandler::SafelyProcessEvent(wxEvent & event) Line 1647	 
	AtlasUI.dll!wxTopLevelWindowMSW::DoSendMenuOpenCloseEvent(int evtType, wxMenu * menu, bool popup) Line 1557	 
	AtlasUI.dll!wxTopLevelWindowMSW::HandleMenuPopup(int evtType, HMENU__ * hMenu) Line 1582	 
	AtlasUI.dll!wxTopLevelWindowMSW::MSWWindowProc(unsigned int message, unsigned int wParam, long lParam) Line 437	 
	AtlasUI.dll!wxFrame::MSWWindowProc(unsigned int message, unsigned int wParam, long lParam) Line 890	 
	AtlasUI.dll!wxWndProc(HWND__ * hWnd, unsigned int message, unsigned int wParam, long lParam) Line 2711	 
	user32.dll!__InternalCallWinProc@20()	 
	user32.dll!UserCallWinProcCheckWow()	 
	user32.dll!DispatchClientMessage()	 
	user32.dll!___fnDWORD@4()	 
	ntdll.dll!_KiUserCallbackDispatcher@12()	 
	win32u.dll!_NtUserMessageCall@28()	 
	user32.dll!RealDefWindowProcWorker()	 
	user32.dll!RealDefWindowProcW()	 
	uxtheme.dll!DoMsgDefault(struct _THEME_MSG const *)	 
	uxtheme.dll!OnDwpSysCommand()	 
	uxtheme.dll!_ThemeDefWindowProc(struct HWND__ *,unsigned int,unsigned int,long,int)	 
	uxtheme.dll!_ThemeDefWindowProcW@16()	 
	user32.dll!DefWindowProcW()	 
	AtlasUI.dll!wxWindow::MSWDefWindowProc(unsigned int nMsg, unsigned int wParam, long lParam) Line 2272	 
	AtlasUI.dll!wxWindow::MSWWindowProc(unsigned int message, unsigned int wParam, long lParam) Line 3651	 
	AtlasUI.dll!wxTopLevelWindowMSW::MSWWindowProc(unsigned int message, unsigned int wParam, long lParam) Line 467	 
	AtlasUI.dll!wxFrame::MSWWindowProc(unsigned int message, unsigned int wParam, long lParam) Line 890	 
	AtlasUI.dll!wxWndProc(HWND__ * hWnd, unsigned int message, unsigned int wParam, long lParam) Line 2711	 
	user32.dll!__InternalCallWinProc@20()	 
	user32.dll!UserCallWinProcCheckWow()	 
	user32.dll!DispatchClientMessage()	 
	user32.dll!___fnDWORD@4()	 
	ntdll.dll!_KiUserCallbackDispatcher@12()	 
	win32u.dll!_NtUserMessageCall@28()	 
	user32.dll!RealDefWindowProcWorker()	 
	user32.dll!RealDefWindowProcW()	 
	uxtheme.dll!DoMsgDefault(struct _THEME_MSG const *)	 
	uxtheme.dll!OnDwpNcLButtonDown()	 
	uxtheme.dll!_ThemeDefWindowProc(struct HWND__ *,unsigned int,unsigned int,long,int)	 
	uxtheme.dll!_ThemeDefWindowProcW@16()	 
	user32.dll!DefWindowProcW()	 
	AtlasUI.dll!wxWindow::MSWDefWindowProc(unsigned int nMsg, unsigned int wParam, long lParam) Line 2272	 
	AtlasUI.dll!wxWindow::MSWWindowProc(unsigned int message, unsigned int wParam, long lParam) Line 3651	 
	AtlasUI.dll!wxTopLevelWindowMSW::MSWWindowProc(unsigned int message, unsigned int wParam, long lParam) Line 467	 
	AtlasUI.dll!wxFrame::MSWWindowProc(unsigned int message, unsigned int wParam, long lParam) Line 890	 
	AtlasUI.dll!wxWndProc(HWND__ * hWnd, unsigned int message, unsigned int wParam, long lParam) Line 2711	 
	user32.dll!__InternalCallWinProc@20()	 
	user32.dll!UserCallWinProcCheckWow()	 
	user32.dll!DispatchMessageWorker()	 
	user32.dll!_DispatchMessageW@4()	 
	AtlasUI.dll!wxGUIEventLoop::ProcessMessage(tagMSG * msg) Line 170	 
	AtlasUI.dll!wxGUIEventLoop::Dispatch() Line 232	 
	AtlasUI.dll!wxEventLoopManual::DoRun() Line 206	 
	AtlasUI.dll!wxEventLoopBase::Run() Line 78	 
	AtlasUI.dll!wxAppConsoleBase::MainLoop() Line 334	 
	AtlasUI.dll!wxEntryReal(int & argc, wchar_t * * argv) Line 495	 
	AtlasUI.dll!wxEntry(int & argc, wchar_t * * argv) Line 188	 
	AtlasUI.dll!wxEntry(HINSTANCE__ * hInstance, HINSTANCE__ * __formal, char * __formal, int nCmdShow) Line 415	 
	AtlasUI.dll!Atlas_StartWindow(const wchar_t * type) Line 132	 
	pyrogenesis.exe!BeginAtlas(const CmdLineArgs & args, const DllLoader & dll) Line 320	 
	pyrogenesis.exe!ATLAS_Run(const CmdLineArgs & args, int flags) Line 54	 
	pyrogenesis.exe!ATLAS_RunIfOnCmdLine(const CmdLineArgs & args, bool force) Line 77	 
	pyrogenesis.exe!RunGameOrAtlas(int argc, const char * * argv) Line 526	 
	pyrogenesis.exe!SDL_main(int argc, char * * argv) Line 675	 
	pyrogenesis.exe!main_utf8(int argc, char * * argv) Line 126	 
	pyrogenesis.exe!wmain(int argc, unsigned short * * wargv, unsigned short * wenvp) Line 151	 
	pyrogenesis.exe!__tmainCRTStartup() Line 623	 
	pyrogenesis.exe!CallStartupWithinTryBlock() Line 365	 
	kernel32.dll!@BaseThreadInitThunk@12()	 
	ntdll.dll!__RtlUserThreadStart()	 
	ntdll.dll!__RtlUserThreadStart@8()	 

Change History (5)

comment:1 by trompetin17, 5 years ago

from https://docs.wxwidgets.org/3.0/classwx_menu_event.html#a8a5986cb633cd44b018b20d7a83b6c60

wxMenu* wxMenuEvent::GetMenu	(		)	const
Returns the menu which is being opened or closed.

This method can only be used with the OPEN and CLOSE events.

The returned value is never NULL in the ports implementing this function, which currently includes all the major ones.

Looks like that getMenu is null when you choose icon menu, maybe we need to add check about null

in reply to:  1 comment:2 by historic_bruno, 5 years ago

That documentation is confusing. If GetMenu "never" returns NULL, why is it happening to us? Perhaps it hasn't been updated with some new behavior, or it might be a bug in our bundled win32 version of mxMSW.

But you're right, adding a NULL check fixes the crash.

Last edited 5 years ago by historic_bruno (previous) (diff)

comment:3 by historic_bruno, 5 years ago

Reported upstream: https://trac.wxwidgets.org/ticket/18443

We'll discover if it's intentional or a bug. In the meantime, we should handle the NULL pointer anyway. Diff coming shortly.

comment:4 by historic_bruno, 5 years ago

Owner: set to historic_bruno
Resolution: fixed
Status: newclosed

In 22467:

Fixes #5501 null pointer exception in AtlasUI on Windows.
Contrary to wxWidgets documentation, wxMenuEvent::GetMenu() can return NULL when the system menu is accessed on wxMSW, see https://trac.wxwidgets.org/ticket/18443.

comment:5 by historic_bruno, 5 years ago

In 22468:

Actually use variable added in r22467. Refs #5501.

Note: See TracTickets for help on using tickets.