<p></p>
<p>At the moment of the crash, the frame sent to <code>gfx_present</code> and the <code>maintexture</code> have already been updated to match the new size of the window. However, a couple times I saw the crash not on the <code>gfx_present</code> after the <code>SDL_WINDOWEVENT_RESIZED</code>, but one frame after that. It appears to always crash on the first present on which the frame/<code>maintexture</code> is resized.</p>
<p>Disabling batching of OpenGL commands didn't help.<br>
Not touching the viewport when receiving a window resize event didn't help.<br>
Removing update_state() calls (which calls SDL_PumpEvents) from gfx_present didn't help (it was unnecessarily called twice).<br>
Removing set_window_size() call from gfx_present (which calls SDL_SetWindowSize, unnecessarily in case of a resize), didn't help.<br>
Bundling into an app didn't help.</p>
<p>But bundling linking SDLMain.m finally did something. I started seeing a different crash in addition to the original:</p>
<pre><code>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)
</code></pre>
<p>another run had it crash instead in</p>
<pre><code>5   libsystem_malloc.dylib               0x00007fff639cc434 free_small + 814
6   ohrrpgce-custom                     0x00000001000a13c1 gfx_paletteDestroy_SW + 145 (surface.cpp:693)
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/ohrrpgce/ohrrpgce/issues/1181#issuecomment-718343523">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AMWGWZX25CRANAVMNYLFUVDSNDRVBANCNFSM4TDDAGOA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AMWGWZUZ7KA2HRFVQA5IKJ3SNDRVBA5CNFSM4TDDAGOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFLIQ2YY.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/ohrrpgce/ohrrpgce/issues/1181#issuecomment-718343523",
"url": "https://github.com/ohrrpgce/ohrrpgce/issues/1181#issuecomment-718343523",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>