[Ohrrpgce] [ohrrpgce/ohrrpgce] Mac/gfx_sdl2: Random crash when resizing window (#1181)

Ralph Versteegen notifications at github.com
Wed Oct 28 20:56:00 PDT 2020


At the moment of the crash, the frame sent to `gfx_present` and the `maintexture` have already been updated to match the new size of the window. However, a couple times I saw the crash not on the `gfx_present` after the `SDL_WINDOWEVENT_RESIZED`, but one frame after that. It appears to always crash on the first present on which the frame/`maintexture` is resized.

Disabling batching of OpenGL commands didn't help.
Not touching the viewport when receiving a window resize event didn't help.
Removing update_state() calls (which calls SDL_PumpEvents) from gfx_present didn't help (it was unnecessarily called twice).
Removing set_window_size() call from gfx_present (which calls SDL_SetWindowSize, unnecessarily in case of a resize), didn't help.
Bundling into an app didn't help.

But bundling linking SDLMain.m finally did something. I started seeing a different crash in addition to the original:
```
Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
abort() called
*** error for object 0x1018a3600: incorrect checksum for freed object - object was probably modified after being freed.
 

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x00007fff63965b66 __pthread_kill + 10
1   libsystem_pthread.dylib       	0x00007fff63b30080 pthread_kill + 333
2   libsystem_c.dylib             	0x00007fff638c11ae abort + 127
3   libsystem_malloc.dylib        	0x00007fff639caad4 szone_error + 596
4   libsystem_malloc.dylib        	0x00007fff639cc0eb small_free_list_remove_ptr_no_clear + 790
5   libsystem_malloc.dylib        	0x00007fff639c0149 small_malloc_from_free_list + 403
6   libsystem_malloc.dylib        	0x00007fff639be859 szone_malloc_should_clear + 1600
7   libsystem_malloc.dylib        	0x00007fff639be1bd malloc_zone_malloc + 103
8   libsystem_malloc.dylib        	0x00007fff639bd4c7 malloc + 24
9   libc++abi.dylib               	0x00007fff617be628 operator new(unsigned long) + 40
10  ohrrpgce-custom               	0x00000001000a12aa gfx_paletteFromRGB_SW + 26 (surface.cpp:678)
11  ohrrpgce-custom               	0x0000000100184d23 PRESENT_INTERNAL_FRAME + 163 (allmodex.bas:1276)
12  ohrrpgce-custom               	0x00000001001a4c35 SETVISPAGE + 1253 (allmodex.bas:1240)
13  ohrrpgce-custom               	0x00000001000ad8af CHOOSE_RPG_TO_OPEN + 1103 (custom.bas:607)
```
another run had it crash instead in 
```
5   libsystem_malloc.dylib        	0x00007fff639cc434 free_small + 814
6   ohrrpgce-custom               	0x00000001000a13c1 gfx_paletteDestroy_SW + 145 (surface.cpp:693)
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/ohrrpgce/ohrrpgce/issues/1181#issuecomment-718343523
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.motherhamster.org/pipermail/ohrrpgce-motherhamster.org/attachments/20201028/06ab1812/attachment.html>


More information about the Ohrrpgce mailing list