<p>Changing map layer tilesets or reordering tilesets can cause Game to crash or draw a map layer with a corrupt tileset. It turns out that while reloading the map, new tilesets are loaded into <code>tilesets()</code> but the Map slices' tileset pointers aren't updated. In practice swapping map layers may or may not cause a <code>TilesetData</code> to be freed, and if it is, it might not be overwritten immediately, so the map layer might continue to display with the old tileset, or the tileset sprite ptr might become garbage. Also, I've seen the game continue to run for a minute and then suddenly crash without user input.</p>
<p>We have many crashreports for this, and I've received a few bug reports, which I hadn't realised were all the same bug.</p>
<p>There are no writes to a TilesetData or anything it contains via a Map slice tileset ptr, so this bug can't cause further memory corruption. All crashes are inside <code>drawmap</code> called from <code>DrawMapSlice</code>. E.g.</p>
<pre><code>85fb4b 20190602 Game wip 20190520.11162 memcpy(msvcrt.dll) <- blitohr <- FRAME_DRAW_INTERNAL <- DRAWMAP <- DRAWMAP <- DRAWMAP <- DrawMapSlice
Admin Kagome.rpg
3602b9 20191001 Game wip 20190912.11319 DRAWMAP(allmodex.bas:3722) <- DRAWMAP <- DRAWMAP <- DrawMapSlice <- DrawSliceRecurse <- DefaultChildDraw
DELL Blood Ledger.rpg Blood Ledg
</code></pre>
<p>So this can't be the cause of bug <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="465850126" data-permission-text="Issue title is private" data-url="https://github.com/ohrrpgce/ohrrpgce/issues/10" data-hovercard-type="issue" data-hovercard-url="/ohrrpgce/ohrrpgce/issues/10/hovercard" href="https://github.com/ohrrpgce/ohrrpgce/issues/10">#10</a> (crash while creating a minimap).</p>
<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/41?email_source=notifications&email_token=AMWGWZWQRID4G6TQXMTKZ23QUNED7A5CNFSM4JO4ZKUKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H2GYCLA">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AMWGWZQHZBI7HQNBYOB5ZL3QUNED7ANCNFSM4JO4ZKUA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AMWGWZWV2G6ADFUPQXTPFGTQUNED7A5CNFSM4JO4ZKUKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H2GYCLA.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/41?email_source=notifications\u0026email_token=AMWGWZWQRID4G6TQXMTKZ23QUNED7A5CNFSM4JO4ZKUKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H2GYCLA",
"url": "https://github.com/ohrrpgce/ohrrpgce/issues/41?email_source=notifications\u0026email_token=AMWGWZWQRID4G6TQXMTKZ23QUNED7A5CNFSM4JO4ZKUKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H2GYCLA",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>