Emulator Issues #6546
closed[4.0] Shutdown PC with Dolphin x64 running causes error message
0%
Description
READ THIS: https://forums.dolphin-emu.org/showthread.php?pid=276132 <<<
Your answers are here!
What went wrong?
Keep dolphin running in the background. Shutdown PC. Causes error message to appear: http://i.imgur.com/5maROt9.jpg
What did you expect to happen instead?
Dolphin closes and PC shuts down gracefully.
What steps will reproduce the problem?
[Don't assume we have played the game and know its level names. Be as
detailed as possible.]
- Dolphin.exe open
- Start -> Shutdown
Which versions of Dolphin did you test on?
Dolphin 3.0 stable x64
Dolphin 3.5 stable x64
Dolphin 3.5 - 2145 x 64
Which version of Dolphin used to work?
x86 builds
What are your PC specifications (example: Operating System, CPU and GPU)?
Windows 7 x64
64 or 32 bit Operating System?
64bit
64 or 32 bit Dolphin?
64bit Dolphin
Any other relevant information (e.g. logs, screenshots, configuration
files)
Seems like it affects X64 builds only. I am unsure if native Windows x86 users would have same issues.
Updated by thealexbarney over 11 years ago
Here are some screen shots of the error I get:
http://i.imgur.com/CuURiup.png
http://i.imgur.com/NAgSuTB.png
Updated by delroth over 11 years ago
- Status changed from New to Accepted
- Priority set to High
- Milestone set to Current
- Operating system Windows added
@thealexbarney: great, you seem to know how to use Visual Studio :)
Could you configure it to use the following symbol server: https://symbols.dolphin-emu.org/ ? This page tells you how to do that: http://msdn.microsoft.com/en-us/library/b8ttk8zy(v=vs.100).aspx
When this is done, try to debug the crash again - it should show you a backtrace with the Dolphin function names. Screenshot this and paste it here please.
Updated by thealexbarney over 11 years ago
@delroth
Alright. And it does crash in XP x86.
Updated by thealexbarney over 11 years ago
DolphinD.exe!wxWindow::MSWHandleMessage(__int64 * result, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 2725 C++
DolphinD.exe!wxWindow::MSWWindowProc(unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 3613 + 0x2c bytes C++
DolphinD.exe!wxTopLevelWindowMSW::MSWWindowProc(unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 420 + 0x18 bytes C++
DolphinD.exe!wxFrame::MSWWindowProc(unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 972 + 0x24 bytes C++
DolphinD.exe!CFrame::MSWWindowProc(unsigned int nMsg, unsigned __int64 wParam, int64 lParam) Line 543 C++
DolphinD.exe!wxWndProc(HWND * hWnd, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 2711 + 0x21 bytes C++
user32.dll!UserCallWinProcCheckWow() + 0x13e bytes
user32.dll!DispatchClientMessage() + 0xa2 bytes
user32.dll!__fnINLPUAHNCPAINTMENUPOPUP() + 0x2f bytes
In the locals window, it gives Error CXX0030: Error: expression cannot be evaluated for the variable 'processed'
Updated by Anonymous over 11 years ago
shuffle2 | so basically it affects all windows versions if you shutdown computer while dolphin is opened
shuffle2 | probably just dolphin failing to handle some window message, delroth
@delroth | wx*
JMC47 | dolphin should just be one of those programs
JMC47 | that refuse to let you shut down until you close it
shuffle2 | delroth: it's going through dolphin's proc first
shuffle2 | either unhandled thing or use after free would be my guess
@delroth | ok
@delroth | care to comment in the issue?
@delroth | so I don't forget about it
Updated by thealexbarney over 11 years ago
I just ran across this issue while tinkering around with the source code to dolphin. Crashed on the exact same line, same call stack, etc. The error was probably my fault, but it was odd seeing this exact same error.
Updated by delroth over 11 years ago
@godisgovernment: it doesn't go through any of the Dolphin code before crashing here. wxWindowProc is part of WX, as is the rest of the stack.
Updated by Anonymous over 11 years ago
The problem is that CFrame::m_Mgr->m_frame->m_hWnd is being released before the CFrame::~CFrame is run, which accesses the wxAui notebook thingy.
I repro'd the crash by running debug and sending WM_ENDSESSION,endsession,ENDSESSION_CLOSEAPP with this app(i'm lazy): http://stefanstools.sourceforge.net/SendMessage.html
If you break on writes to this m_hWnd, you'll see that it is set to NULL with this stack before CFrame::~CFrame is called:
http://pastie.org/pastes/8307388/text
0:000> ??this->m_Mgr->m_frame->m_hWnd
struct HWND__ * 0x0000000000000000 continuing onwards, you see a few complaints about the hwnd being bad before it actually asserts on such a check: C:\Users\delroth\buildslave\debug-win-x64\build\Externals\wxWidgets3\include\wx/msw/private.h(391): 'GetClientRect' failed with error 0x00000578 (invalid window handle.). C:\Users\delroth\buildslave\debug-win-x64\build\Externals\wxWidgets3\include\wx/msw/private.h(391): 'GetClientRect' failed with error 0x00000578 (invalid window handle.). C:\Users\delroth\buildslave\debug-win-x64\build\Externals\wxWidgets3\include\wx/msw/private.h(391): 'GetClientRect' failed with error 0x00000578 (invalid window handle.). C:\Users\delroth\buildslave\debug-win-x64\build\Externals\wxWidgets3\include\wx/msw/private.h(391): 'GetClientRect' failed with error 0x00000578 (invalid window handle.). C:\Users\delroth\buildslave\debug-win-x64\build\Externals\wxWidgets3\include\wx/msw/private.h(391): 'GetClientRect' failed with error 0x00000578 (invalid window handle.). C:\Users\delroth\buildslave\debug-win-x64\build\Externals\wxWidgets3\include\wx/msw/private.h(391): 'GetClientRect' failed with error 0x00000578 (invalid window handle.). ..\..\src\msw\window.cpp(1149): assert "((HWND)GetHWND())" failed in wxWindow::GetLayoutDirection(): invalid window (824.1010): Unknown exception - code 00001976 (first chance) dbghelp: SymInitialize() failed: the parameter is incorrect. ..\..\src\msw\window.cpp(4793): 'GetUpdateRgn' failed with error 0x00000578 (invalid window handle.). (824.1010): Break instruction exception - code 80000003 (first chance) KERNELBASE!DebugBreak+0x2: 000007fc
01ca478a cc int 3
the stack of crashing thread is:
http://pastie.org/pastes/8307396/text
you can see from frame 36 we are now actually in the dtor, and the assert happens where previously noted.
At the moment I don't really know what the best way to fix is, maybe someone else can do it :)
Updated by delroth over 11 years ago
Dirty, but what about handling ENDSESSION ourselves and exiting Dolphin properly?
Updated by Anonymous over 11 years ago
http://docs.wxwidgets.org/trunk/overview_app.html#overview_app_shutdown
This is not directly applicable, but it looks like wxw does not intend you to use C++ ctor/dtor to manage lifetime of wxw-managed objects. If dolphin really needs to be touching m_Mgr on close, maybe just do it in some event (assuming the event is triggered before wxw propagates the ENDSESSION to the base of wxwTopLevelWindow) instead of ~CFrame?
Updated by Anonymous over 11 years ago
- Status changed from Accepted to Fixed
This issue was closed by revision 484130049da6.
Updated by Anonymous over 11 years ago
This issue was closed by revision 484130049da6.