Jump to content

[trunk@23664] Can't open Atlas Editor on OSX Catalina (10.15.4)


wik
 Share

Recommended Posts

trunk@23664 + https://code.wildfiregames.com/D2716 (just so I can build on Catalina)

Build is ok, game is ok, but atlas editor returns the following:

[1]    7736 illegal hardware instruction  binaries/system/pyrogenesis --editor

With debugger:

lldb binaries/system/pyrogenesis
run -editor
Process 10242 stopped
* thread #2, stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
    frame #0: 0x00007fff31b7465c AppKit`-[NSOpenGLContext setView:] + 229
AppKit`-[NSOpenGLContext setView:]:
->  0x7fff31b7465c <+229>: ud2    
    0x7fff31b7465e <+231>: movq   %rax, %r14
    0x7fff31b74661 <+234>: jmp    0x7fff31b74676            ; <+255>
    0x7fff31b74663 <+236>: movq   %rax, %rdi
Target 0: (pyrogenesis) stopped.

Backtrace:

(lldb) bt
* thread #2, stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
  * frame #0: 0x00007fff31b7465c AppKit`-[NSOpenGLContext setView:] + 229
    frame #1: 0x00000001078e3922 libAtlasUI.dylib`wxGLContext::SetCurrent(this=0x0000000110c51e08, win=0x0000000110c51af0) const at glcanvas.mm:335:5
    frame #2: 0x000000010039c224 pyrogenesis`RunEngine(args=<unavailable>) at GameLoop.cpp:174:6 [opt]
    frame #3: 0x000000010039c97a pyrogenesis`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> > >(void*) [inlined] decltype(std::__1::forward<void (*)(CmdLineArgs const&)>(fp)(std::__1::forward<std::__1::reference_wrapper<CmdLineArgs const> >(fp0))) std::__1::__invoke<void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> >(void (*&&)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const>&&) at type_traits:4425:1 [opt]
    frame #4: 0x000000010039c976 pyrogenesis`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> > >(void*) [inlined] void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const>, 2ul>(__t=<unavailable>)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> >&, std::__1::__tuple_indices<2ul>) at thread:341 [opt]
    frame #5: 0x000000010039c972 pyrogenesis`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> > >(__vp=0x000000010404f3b0) at thread:351 [opt]
    frame #6: 0x00007fff6e69f109 libsystem_pthread.dylib`_pthread_start + 148
    frame #7: 0x00007fff6e69ab8b libsystem_pthread.dylib`thread_start + 15

libraries/osx/wxwidgets/wxWidgets-3.0.3.1/src/osx/cocoa/glcanvas.mm:335

bool wxGLContext::SetCurrent(const wxGLCanvas& win) const
{
    if ( !m_glContext )
        return false;  

    [m_glContext setView: win.GetHandle() ]; // LINE 335
    [m_glContext update];

    [m_glContext makeCurrentContext];
    
    return true;
}

Similar issue in other projects:

https://github.com/google/filament/pull/1959/files

https://github.com/stepmania/stepmania/pull/1933/commits/81a041e3dd7a8a06ef85db7897572b816bbaba2a

When I change wxGLContext::SetCurrent (glcanvas.mm around line 335) to the following:

bool wxGLContext::SetCurrent(const wxGLCanvas& win) const
{
    if ( !m_glContext )
        return false;  

    dispatch_async(dispatch_get_main_queue(), ^{
        [m_glContext setView: win.GetHandle() ];
        [m_glContext update];
    });

    [m_glContext makeCurrentContext];
    
    return true;
}

NOTE: I have to use "_async", because the "_sync" one (used in other projects) creates deadlock here (not 100% sure why).

And re-build affected parts of the project:

pushd libraries/osx/wxwidgets/wxWidgets-3.0.3.1/build-release
make -j8 && make install
popd
pushd build/workspaces/gcc
make -C . -f AtlasUI.make verbose=true clean
make -j8
popd

The next problem appears:

Assertion failure at SDL_GetWindowWMInfo_REAL (/Users/wik/code/0ad/0ad/libraries/osx/sdl2/SDL2-2.0.12/src/video/SDL_video.c:3760), triggered 1 time:
  'window && window->magic == &_this->window_magic'
2020-05-19 02:07:02.937 pyrogenesis[35178:7417651] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff345ced07 __exceptionPreprocess + 250
	1   libobjc.A.dylib                     0x00007fff6d2f35bf objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff345f750c -[NSException raise] + 9
	3   AppKit                              0x00007fff317fe24c -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 310
	4   AppKit                              0x00007fff317e5cb2 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1416
	5   AppKit                              0x00007fff319c6a15 -[NSPanel _initContent:styleMask:backing:defer:contentView:] + 50
	6   AppKit                              0x00007fff317e5723 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 42
	7   AppKit                              0x00007fff319c69ca -[NSPanel initWithContentRect:styleMask:backing:defer:] + 64
	8   AppKit                              0x00007fff317e3709 -[NSWindowTemplate nibInstantiate] + 393
	9   AppKit                              0x00007fff317adaa6 -[NSIBObjectData instantiateObject:] + 253
	10  AppKit                              0x00007fff317ad160 -[NSIBObjectData nibInstantiateWithOwner:options:topLevelObjects:] + 534
	11  AppKit                              0x00007fff317a1331 loadNib + 401
	12  AppKit                              0x00007fff317a08f2 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:options:withZone:ownerBundle:] + 693
	13  AppKit                              0x00007fff317a0548 -[NSBundle(NSNibLoading) loadNibNamed:owner:topLevelObjects:] + 201
	14  AppKit                              0x00007fff31b691c4 -[NSAlert init] + 101
	15  pyrogenesis                         0x000000010ff306a8 Cocoa_ShowMessageBox + 72
	16  pyrogenesis                         0x000000010fe583f7 SDL_ShowMessageBox_REAL + 343
	17  pyrogenesis                         0x000000010fd3ab81 SDL_PromptAssertion + 753
	18  pyrogenesis                         0x000000010fd3a625 SDL_ReportAssertion_REAL + 325
	19  pyrogenesis                         0x000000010fe57fe8 SDL_GetWindowWMInfo_REAL + 152
	20  pyrogenesis                         0x000000010fd560b1 SDL_GetWindowWMInfo + 33
	21  pyrogenesis                         0x000000010fcdcafa _Z15GetSDLSubsystemP10SDL_Window + 42
	22  pyrogenesis                         0x000000010fa91fbe _Z20RunHardwareDetectionv + 2190
	23  pyrogenesis                         0x000000010fa83a99 _Z12InitGraphicsRK11CmdLineArgsiRKNSt3__16vectorI5CStr8NS2_9allocatorIS4_EEEE + 329
	24  pyrogenesis                         0x000000010fc38f25 _ZN12AtlasMessage13fInitGraphicsEPNS_13mInitGraphicsE + 69
	25  pyrogenesis                         0x000000010fc250a4 _ZL9RunEngineRK11CmdLineArgs + 948
	26  pyrogenesis                         0x000000010fc257fa _ZNSt3__114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEPFvRK11CmdLineArgsENS_17reference_wrapperIS8_EEEEEEEPvSF_ + 58
	27  libsystem_pthread.dylib             0x00007fff6e69f109 _pthread_start + 148
	28  libsystem_pthread.dylib             0x00007fff6e69ab8b thread_start + 15
)
libc++abi.dylib: terminating with uncaught exception of type NSException
[1]    35178 abort      binaries/system/pyrogenesis --editor

Backtrace from debugger:

(lldb) bt
* thread #2, stop reason = signal SIGABRT
  * frame #0: 0x00007fff6e5e233a libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007fff6e69ee60 libsystem_pthread.dylib`pthread_kill + 430
    frame #2: 0x00007fff6e569808 libsystem_c.dylib`abort + 120
    frame #3: 0x00007fff6b7c9458 libc++abi.dylib`abort_message + 231
    frame #4: 0x00007fff6b7ba8bf libc++abi.dylib`demangling_terminate_handler() + 262
    frame #5: 0x00007fff6d2f55a9 libobjc.A.dylib`_objc_terminate() + 96
    frame #6: 0x00007fff6b7c8887 libc++abi.dylib`std::__terminate(void (*)()) + 8
    frame #7: 0x00007fff6b7cb1a2 libc++abi.dylib`__cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) + 27
    frame #8: 0x00007fff6b7cb169 libc++abi.dylib`__cxa_throw + 113
    frame #9: 0x00007fff6d2f36ed libobjc.A.dylib`objc_exception_throw + 350
    frame #10: 0x00007fff345f750c CoreFoundation`-[NSException raise] + 9
    frame #11: 0x00007fff317fe24c AppKit`-[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 310
    frame #12: 0x00007fff317e5cb2 AppKit`-[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1416
    frame #13: 0x00007fff319c6a15 AppKit`-[NSPanel _initContent:styleMask:backing:defer:contentView:] + 50
    frame #14: 0x00007fff317e5723 AppKit`-[NSWindow initWithContentRect:styleMask:backing:defer:] + 42
    frame #15: 0x00007fff319c69ca AppKit`-[NSPanel initWithContentRect:styleMask:backing:defer:] + 64
    frame #16: 0x00007fff317e3709 AppKit`-[NSWindowTemplate nibInstantiate] + 393
    frame #17: 0x00007fff317adaa6 AppKit`-[NSIBObjectData instantiateObject:] + 253
    frame #18: 0x00007fff317ad160 AppKit`-[NSIBObjectData nibInstantiateWithOwner:options:topLevelObjects:] + 534
    frame #19: 0x00007fff317a1331 AppKit`loadNib + 401
    frame #20: 0x00007fff317a08f2 AppKit`+[NSBundle(NSNibLoading) _loadNibFile:nameTable:options:withZone:ownerBundle:] + 693
    frame #21: 0x00007fff317a0548 AppKit`-[NSBundle(NSNibLoading) loadNibNamed:owner:topLevelObjects:] + 201
    frame #22: 0x00007fff31b691c4 AppKit`-[NSAlert init] + 101
    frame #23: 0x00000001006a76a8 pyrogenesis`Cocoa_ShowMessageBox + 72
    frame #24: 0x00000001005cf3f7 pyrogenesis`SDL_ShowMessageBox_REAL + 343
    frame #25: 0x00000001004b1b81 pyrogenesis`SDL_PromptAssertion + 753
    frame #26: 0x00000001004b1625 pyrogenesis`SDL_ReportAssertion_REAL + 325
    frame #27: 0x00000001005cefe8 pyrogenesis`SDL_GetWindowWMInfo_REAL + 152
    frame #28: 0x00000001004cd0b1 pyrogenesis`SDL_GetWindowWMInfo + 33
    frame #29: 0x0000000100453afa pyrogenesis`GetSDLSubsystem(window=<unavailable>) at libsdl.cpp:37:7 [opt]
    frame #30: 0x0000000100208fbe pyrogenesis`RunHardwareDetection() [inlined] ReportSDL(scriptInterface=<unavailable>, settings=<unavailable>) at HWDetect.cpp:386:24 [opt]
    frame #31: 0x0000000100208efb pyrogenesis`RunHardwareDetection() at HWDetect.cpp:289 [opt]
    frame #32: 0x00000001001faa99 pyrogenesis`InitGraphics(args=0x000000010331b2d0, flags=3, installedMods=size=0) at GameSetup.cpp:1017:2 [opt]
    frame #33: 0x00000001003aff25 pyrogenesis`AtlasMessage::fInitGraphics(msg=<unavailable>) at GraphicsSetupHandlers.cpp:89:2 [opt]
    frame #34: 0x000000010039c0a4 pyrogenesis`RunEngine(args=<unavailable>) at GameLoop.cpp:174:6 [opt]
    frame #35: 0x000000010039c7fa pyrogenesis`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> > >(void*) [inlined] decltype(std::__1::forward<void (*)(CmdLineArgs const&)>(fp)(std::__1::forward<std::__1::reference_wrapper<CmdLineArgs const> >(fp0))) std::__1::__invoke<void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> >(void (*&&)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const>&&) at type_traits:4425:1 [opt]
    frame #36: 0x000000010039c7f6 pyrogenesis`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> > >(void*) [inlined] void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const>, 2ul>(__t=<unavailable>)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> >&, std::__1::__tuple_indices<2ul>) at thread:341 [opt]
    frame #37: 0x000000010039c7f2 pyrogenesis`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> > >(__vp=0x0000000104006050) at thread:351 [opt]
    frame #38: 0x00007fff6e69f109 libsystem_pthread.dylib`_pthread_start + 148
    frame #39: 0x00007fff6e69ab8b libsystem_pthread.dylib`thread_start + 15

Changing the following lines https://github.com/0ad/0ad/blob/1bfe7b2905a88b60d9299dc1614eede2e6fab2f9/source/ps/GameSetup/HWDetect.cpp#L386-L387

	const char* backend = GetSDLSubsystem(g_VideoMode.GetWindow());
	scriptInterface.SetProperty(settings, "sdl_video_backend", backend ? backend : "unknown");

To

	// can't access window from current thread,
	// g_VideoMode.GetWindow() => EXC_BAD_ACCESS
	//const char* backend = GetSDLSubsystem(g_VideoMode.GetWindow());
	scriptInterface.SetProperty(settings, "sdl_video_backend", "unknown");

Allows to run editor again, there are some other issues though

1678715973_Screenshot2020-05-19at02_20_59.thumb.png.5babecf853c719ec6a70c77118d3b22c.png

It is impossible to enter any text into input fields, for some reason it captures all input on the terminal only

Another problem is similar to one previously reported, but upgrading to SDL2-2.0.12 didn't help in this case:

 

Link to comment
Share on other sites

4 hours ago, wik said:

trunk@23664 + https://code.wildfiregames.com/D2716 (just so I can build on Catalina)

Build is ok, game is ok, but atlas editor returns the following:

[1]    7736 illegal hardware instruction  binaries/system/pyrogenesis --editor

With debugger:


lldb binaries/system/pyrogenesis
run -editor
Process 10242 stopped
* thread #2, stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
    frame #0: 0x00007fff31b7465c AppKit`-[NSOpenGLContext setView:] + 229
AppKit`-[NSOpenGLContext setView:]:
->  0x7fff31b7465c <+229>: ud2    
    0x7fff31b7465e <+231>: movq   %rax, %r14
    0x7fff31b74661 <+234>: jmp    0x7fff31b74676            ; <+255>
    0x7fff31b74663 <+236>: movq   %rax, %rdi
Target 0: (pyrogenesis) stopped.

Backtrace:


(lldb) bt
* thread #2, stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
  * frame #0: 0x00007fff31b7465c AppKit`-[NSOpenGLContext setView:] + 229
    frame #1: 0x00000001078e3922 libAtlasUI.dylib`wxGLContext::SetCurrent(this=0x0000000110c51e08, win=0x0000000110c51af0) const at glcanvas.mm:335:5
    frame #2: 0x000000010039c224 pyrogenesis`RunEngine(args=<unavailable>) at GameLoop.cpp:174:6 [opt]
    frame #3: 0x000000010039c97a pyrogenesis`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> > >(void*) [inlined] decltype(std::__1::forward<void (*)(CmdLineArgs const&)>(fp)(std::__1::forward<std::__1::reference_wrapper<CmdLineArgs const> >(fp0))) std::__1::__invoke<void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> >(void (*&&)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const>&&) at type_traits:4425:1 [opt]
    frame #4: 0x000000010039c976 pyrogenesis`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> > >(void*) [inlined] void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const>, 2ul>(__t=<unavailable>)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> >&, std::__1::__tuple_indices<2ul>) at thread:341 [opt]
    frame #5: 0x000000010039c972 pyrogenesis`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> > >(__vp=0x000000010404f3b0) at thread:351 [opt]
    frame #6: 0x00007fff6e69f109 libsystem_pthread.dylib`_pthread_start + 148
    frame #7: 0x00007fff6e69ab8b libsystem_pthread.dylib`thread_start + 15

libraries/osx/wxwidgets/wxWidgets-3.0.3.1/src/osx/cocoa/glcanvas.mm:335


bool wxGLContext::SetCurrent(const wxGLCanvas& win) const
{
    if ( !m_glContext )
        return false;  

    [m_glContext setView: win.GetHandle() ]; // LINE 335
    [m_glContext update];

    [m_glContext makeCurrentContext];
    
    return true;
}

Similar issue in other projects:

https://github.com/google/filament/pull/1959/files

https://github.com/stepmania/stepmania/pull/1933/commits/81a041e3dd7a8a06ef85db7897572b816bbaba2a

When I change wxGLContext::SetCurrent (glcanvas.mm around line 335) to the following:


bool wxGLContext::SetCurrent(const wxGLCanvas& win) const
{
    if ( !m_glContext )
        return false;  

    dispatch_async(dispatch_get_main_queue(), ^{
        [m_glContext setView: win.GetHandle() ];
        [m_glContext update];
    });

    [m_glContext makeCurrentContext];
    
    return true;
}

NOTE: I have to use "_async", because the "_sync" one (used in other projects) creates deadlock here (not 100% sure why).

And re-build affected parts of the project:


pushd libraries/osx/wxwidgets/wxWidgets-3.0.3.1/build-release
make -j8 && make install
popd
pushd build/workspaces/gcc
make -C . -f AtlasUI.make verbose=true clean
make -j8
popd

The next problem appears:


Assertion failure at SDL_GetWindowWMInfo_REAL (/Users/wik/code/0ad/0ad/libraries/osx/sdl2/SDL2-2.0.12/src/video/SDL_video.c:3760), triggered 1 time:
  'window && window->magic == &_this->window_magic'
2020-05-19 02:07:02.937 pyrogenesis[35178:7417651] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff345ced07 __exceptionPreprocess + 250
	1   libobjc.A.dylib                     0x00007fff6d2f35bf objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff345f750c -[NSException raise] + 9
	3   AppKit                              0x00007fff317fe24c -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 310
	4   AppKit                              0x00007fff317e5cb2 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1416
	5   AppKit                              0x00007fff319c6a15 -[NSPanel _initContent:styleMask:backing:defer:contentView:] + 50
	6   AppKit                              0x00007fff317e5723 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 42
	7   AppKit                              0x00007fff319c69ca -[NSPanel initWithContentRect:styleMask:backing:defer:] + 64
	8   AppKit                              0x00007fff317e3709 -[NSWindowTemplate nibInstantiate] + 393
	9   AppKit                              0x00007fff317adaa6 -[NSIBObjectData instantiateObject:] + 253
	10  AppKit                              0x00007fff317ad160 -[NSIBObjectData nibInstantiateWithOwner:options:topLevelObjects:] + 534
	11  AppKit                              0x00007fff317a1331 loadNib + 401
	12  AppKit                              0x00007fff317a08f2 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:options:withZone:ownerBundle:] + 693
	13  AppKit                              0x00007fff317a0548 -[NSBundle(NSNibLoading) loadNibNamed:owner:topLevelObjects:] + 201
	14  AppKit                              0x00007fff31b691c4 -[NSAlert init] + 101
	15  pyrogenesis                         0x000000010ff306a8 Cocoa_ShowMessageBox + 72
	16  pyrogenesis                         0x000000010fe583f7 SDL_ShowMessageBox_REAL + 343
	17  pyrogenesis                         0x000000010fd3ab81 SDL_PromptAssertion + 753
	18  pyrogenesis                         0x000000010fd3a625 SDL_ReportAssertion_REAL + 325
	19  pyrogenesis                         0x000000010fe57fe8 SDL_GetWindowWMInfo_REAL + 152
	20  pyrogenesis                         0x000000010fd560b1 SDL_GetWindowWMInfo + 33
	21  pyrogenesis                         0x000000010fcdcafa _Z15GetSDLSubsystemP10SDL_Window + 42
	22  pyrogenesis                         0x000000010fa91fbe _Z20RunHardwareDetectionv + 2190
	23  pyrogenesis                         0x000000010fa83a99 _Z12InitGraphicsRK11CmdLineArgsiRKNSt3__16vectorI5CStr8NS2_9allocatorIS4_EEEE + 329
	24  pyrogenesis                         0x000000010fc38f25 _ZN12AtlasMessage13fInitGraphicsEPNS_13mInitGraphicsE + 69
	25  pyrogenesis                         0x000000010fc250a4 _ZL9RunEngineRK11CmdLineArgs + 948
	26  pyrogenesis                         0x000000010fc257fa _ZNSt3__114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEPFvRK11CmdLineArgsENS_17reference_wrapperIS8_EEEEEEEPvSF_ + 58
	27  libsystem_pthread.dylib             0x00007fff6e69f109 _pthread_start + 148
	28  libsystem_pthread.dylib             0x00007fff6e69ab8b thread_start + 15
)
libc++abi.dylib: terminating with uncaught exception of type NSException
[1]    35178 abort      binaries/system/pyrogenesis --editor

Backtrace from debugger:


(lldb) bt
* thread #2, stop reason = signal SIGABRT
  * frame #0: 0x00007fff6e5e233a libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007fff6e69ee60 libsystem_pthread.dylib`pthread_kill + 430
    frame #2: 0x00007fff6e569808 libsystem_c.dylib`abort + 120
    frame #3: 0x00007fff6b7c9458 libc++abi.dylib`abort_message + 231
    frame #4: 0x00007fff6b7ba8bf libc++abi.dylib`demangling_terminate_handler() + 262
    frame #5: 0x00007fff6d2f55a9 libobjc.A.dylib`_objc_terminate() + 96
    frame #6: 0x00007fff6b7c8887 libc++abi.dylib`std::__terminate(void (*)()) + 8
    frame #7: 0x00007fff6b7cb1a2 libc++abi.dylib`__cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) + 27
    frame #8: 0x00007fff6b7cb169 libc++abi.dylib`__cxa_throw + 113
    frame #9: 0x00007fff6d2f36ed libobjc.A.dylib`objc_exception_throw + 350
    frame #10: 0x00007fff345f750c CoreFoundation`-[NSException raise] + 9
    frame #11: 0x00007fff317fe24c AppKit`-[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 310
    frame #12: 0x00007fff317e5cb2 AppKit`-[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1416
    frame #13: 0x00007fff319c6a15 AppKit`-[NSPanel _initContent:styleMask:backing:defer:contentView:] + 50
    frame #14: 0x00007fff317e5723 AppKit`-[NSWindow initWithContentRect:styleMask:backing:defer:] + 42
    frame #15: 0x00007fff319c69ca AppKit`-[NSPanel initWithContentRect:styleMask:backing:defer:] + 64
    frame #16: 0x00007fff317e3709 AppKit`-[NSWindowTemplate nibInstantiate] + 393
    frame #17: 0x00007fff317adaa6 AppKit`-[NSIBObjectData instantiateObject:] + 253
    frame #18: 0x00007fff317ad160 AppKit`-[NSIBObjectData nibInstantiateWithOwner:options:topLevelObjects:] + 534
    frame #19: 0x00007fff317a1331 AppKit`loadNib + 401
    frame #20: 0x00007fff317a08f2 AppKit`+[NSBundle(NSNibLoading) _loadNibFile:nameTable:options:withZone:ownerBundle:] + 693
    frame #21: 0x00007fff317a0548 AppKit`-[NSBundle(NSNibLoading) loadNibNamed:owner:topLevelObjects:] + 201
    frame #22: 0x00007fff31b691c4 AppKit`-[NSAlert init] + 101
    frame #23: 0x00000001006a76a8 pyrogenesis`Cocoa_ShowMessageBox + 72
    frame #24: 0x00000001005cf3f7 pyrogenesis`SDL_ShowMessageBox_REAL + 343
    frame #25: 0x00000001004b1b81 pyrogenesis`SDL_PromptAssertion + 753
    frame #26: 0x00000001004b1625 pyrogenesis`SDL_ReportAssertion_REAL + 325
    frame #27: 0x00000001005cefe8 pyrogenesis`SDL_GetWindowWMInfo_REAL + 152
    frame #28: 0x00000001004cd0b1 pyrogenesis`SDL_GetWindowWMInfo + 33
    frame #29: 0x0000000100453afa pyrogenesis`GetSDLSubsystem(window=<unavailable>) at libsdl.cpp:37:7 [opt]
    frame #30: 0x0000000100208fbe pyrogenesis`RunHardwareDetection() [inlined] ReportSDL(scriptInterface=<unavailable>, settings=<unavailable>) at HWDetect.cpp:386:24 [opt]
    frame #31: 0x0000000100208efb pyrogenesis`RunHardwareDetection() at HWDetect.cpp:289 [opt]
    frame #32: 0x00000001001faa99 pyrogenesis`InitGraphics(args=0x000000010331b2d0, flags=3, installedMods=size=0) at GameSetup.cpp:1017:2 [opt]
    frame #33: 0x00000001003aff25 pyrogenesis`AtlasMessage::fInitGraphics(msg=<unavailable>) at GraphicsSetupHandlers.cpp:89:2 [opt]
    frame #34: 0x000000010039c0a4 pyrogenesis`RunEngine(args=<unavailable>) at GameLoop.cpp:174:6 [opt]
    frame #35: 0x000000010039c7fa pyrogenesis`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> > >(void*) [inlined] decltype(std::__1::forward<void (*)(CmdLineArgs const&)>(fp)(std::__1::forward<std::__1::reference_wrapper<CmdLineArgs const> >(fp0))) std::__1::__invoke<void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> >(void (*&&)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const>&&) at type_traits:4425:1 [opt]
    frame #36: 0x000000010039c7f6 pyrogenesis`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> > >(void*) [inlined] void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const>, 2ul>(__t=<unavailable>)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> >&, std::__1::__tuple_indices<2ul>) at thread:341 [opt]
    frame #37: 0x000000010039c7f2 pyrogenesis`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(CmdLineArgs const&), std::__1::reference_wrapper<CmdLineArgs const> > >(__vp=0x0000000104006050) at thread:351 [opt]
    frame #38: 0x00007fff6e69f109 libsystem_pthread.dylib`_pthread_start + 148
    frame #39: 0x00007fff6e69ab8b libsystem_pthread.dylib`thread_start + 15

Changing the following lines https://github.com/0ad/0ad/blob/1bfe7b2905a88b60d9299dc1614eede2e6fab2f9/source/ps/GameSetup/HWDetect.cpp#L386-L387


	const char* backend = GetSDLSubsystem(g_VideoMode.GetWindow());
	scriptInterface.SetProperty(settings, "sdl_video_backend", backend ? backend : "unknown");

To


	// can't access window from current thread,
	// g_VideoMode.GetWindow() => EXC_BAD_ACCESS
	//const char* backend = GetSDLSubsystem(g_VideoMode.GetWindow());
	scriptInterface.SetProperty(settings, "sdl_video_backend", "unknown");

Allows to run editor again, there are some other issues though

1678715973_Screenshot2020-05-19at02_20_59.thumb.png.5babecf853c719ec6a70c77118d3b22c.png

It is impossible to enter any text into input fields, for some reason it captures all input on the terminal only

Another problem is similar to one previously reported, but upgrading to SDL2-2.0.12 didn't help in this case:

 

@Stan` @vladislavbelov @trompetin17 @wraitii @Itms

  • Like 1
Link to comment
Share on other sites

I failed to read your post and found a different solution in https://code.wildfiregames.com/D2752, but I suppose people will prefer your fixes for being less disruptive. I'll make a diff with your changes too. Thanks for reporting and debugging this.

I report text input as working "correctly" if launched from in-game (as in, it's broken as it is on 10.14 with the double character thing).

Edit: mh, pathching wxwidgets though.

  • Like 2
Link to comment
Share on other sites

7 hours ago, wraitii said:

I failed to read your post and found a different solution in https://code.wildfiregames.com/D2752, but I suppose people will prefer your fixes for being less disruptive. I'll make a diff with your changes too. Thanks for reporting and debugging this.

I report text input as working "correctly" if launched from in-game (as in, it's broken as it is on 10.14 with the double character thing).

Edit: mh, pathching wxwidgets though.

Thanks, I'll take a look into D2752.
Pathching wxwidgets was helpful to discover any further problems, but probably not the best choice for long term solution unless there are no alternatives. :)

I've pushed my changes to github with some notes/instructions, just in case, https://github.com/yevgenko/0ad/pull/1

 

  • Like 1
Link to comment
Share on other sites

@wraitii I had another look into "assertion failure" from SDL you mentioned in D2752

Assertion failure at SDL_GetWindowWMInfo_REAL (/Users/Shared/github_repos/0ad/libraries/osx/sdl2/SDL2-2.0.12/src/video/SDL_video.c:3760), triggered 1 time:
  'window && window->magic == &_this->window_magic'

and it looks like the reason for this is because we pass NULL as window and SDL 2.0.12 now throws an assertion for the case

SDL_GetWindowWMInfo(SDL_Window * window, struct SDL_SysWMinfo *info)
{
    CHECK_WINDOW_MAGIC(window, SDL_FALSE); // Line 3760, see SDL_Assert in CHECK_WINDOW_MAGIC definition below

    if (!info) {
        SDL_InvalidParamError("info");
        return SDL_FALSE;
    }
    info->subsystem = SDL_SYSWM_UNKNOWN;

    if (!_this->GetWindowWMInfo) {
        SDL_Unsupported();
        return SDL_FALSE;
    }
    return (_this->GetWindowWMInfo(_this, window, info));
}

#define CHECK_WINDOW_MAGIC(window, retval) \
    if (!_this) { \
        SDL_UninitializedVideo(); \
        return retval; \
    } \
    SDL_assert(window && window->magic == &_this->window_magic); \
    if (!window || window->magic != &_this->window_magic) { \
        SDL_SetError("Invalid window"); \
        return retval; \
    }

The NULL comes from g_VideoMode.GetWindow() here:

https://github.com/0ad/0ad/blob/3d2eca39310a27dbf7793e246392e97f14f5b01e/source/ps/GameSetup/HWDetect.cpp#L386

const char* backend = GetSDLSubsystem(g_VideoMode.GetWindow());
scriptInterface.SetProperty(settings, "sdl_video_backend", backend ? backend : "unknown");

I also noticed that it is only NULL with "-editor" argument: "./binaries/system/pyrogenesis -editor" and it NOT in game. In game there is pointer to the window.
It is normal not having window in editor?

Link to comment
Share on other sites

I should mention that assertion gives you option to ignore problem and still open editor, but it can't detect sdl_video_backend without window

./binaries/system/pyrogenesis
cat '/Users/wik/Library/Application Support/0ad/logs/userreport_hwdetect.txt' | grep 'sdl_video_backend'
  "sdl_video_backend": "Cocoa",

./binaries/system/pyrogenesis -editor
cat '/Users/wik/Library/Application Support/0ad/logs/userreport_hwdetect.txt' | grep 'sdl_video_backend'
  "sdl_video_backend": "unknown",


 

Link to comment
Share on other sites

SDL2-2.0.5 (current trunk) doesn't show assertion alert, but sdl_video_backend is still unknown with -editor

./binaries/system/pyrogenesis
cat '/Users/wik/Library/Application Support/0ad/logs/userreport_hwdetect.txt' | grep 'sdl_video_backend'
  "sdl_video_backend": "Cocoa",

./binaries/system/pyrogenesis -editor
cat '/Users/wik/Library/Application Support/0ad/logs/userreport_hwdetect.txt' | grep 'sdl_video_backend'
  "sdl_video_backend": "unknown",

and there are more problems with SDL2-2.0.5, for example, it is impossible to enter / change any text fields in game, for example: to log into Lobby or change Player Name for Multiplayer

Link to comment
Share on other sites

4 hours ago, wik said:

It is normal not having window in editor?

The only place we set m_Window is in CVideoMode::SetVideoMode:

https://github.com/0ad/0ad/blob/3d2eca39310a27dbf7793e246392e97f14f5b01e/source/ps/VideoMode.cpp#L86

m_Window = SDL_CreateWindow("0 A.D.", m_WindowedX, m_WindowedY, w, h, flags);

But with "-editor" argument we skip this step in game setup:

https://github.com/0ad/0ad/blob/3d2eca39310a27dbf7793e246392e97f14f5b01e/source/ps/GameSetup/GameSetup.cpp#L1009

void InitGraphics(const CmdLineArgs& args, int flags, const std::vector<CStr>& installedMods)
{
	const bool setup_vmode = (flags & INIT_HAVE_VMODE) == 0;

	if(setup_vmode)
	{
		InitSDL();

		if (!g_VideoMode.InitSDL())
			throw PSERROR_System_VmodeFailed(); // abort startup
	}

Because of the flag argument from GraphicsSetupHandlers

https://github.com/0ad/0ad/blob/3d2eca39310a27dbf7793e246392e97f14f5b01e/source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp#L41

const int g_InitFlags = INIT_HAVE_VMODE|INIT_NO_GUI;

Which we then pass to InitGraphics here:

https://github.com/0ad/0ad/blob/3d2eca39310a27dbf7793e246392e97f14f5b01e/source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp#L89

InitGraphics(g_AtlasGameLoop->args, g_InitFlags, {});

So, I suppose it is ok/intentional not having m_Window (g_VideoMode.GetWindow()) with "-editor" argument

https://github.com/0ad/0ad/blob/3d2eca39310a27dbf7793e246392e97f14f5b01e/source/ps/GameSetup/GameSetup.h#L43 

enum InitFlags
{
	// avoid setting a video mode / initializing OpenGL; assume that has
	// already been done and everything is ready for rendering.
	// needed by map editor because it creates its own window.
	INIT_HAVE_VMODE = 1,


Perhaps we need a different way to report sdl_video_backend in atlas editor, i.e. without window? :)

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...