by phantombeta » Tue Jan 16, 2018 9:44 am
While working on my mod, I stumbled upon a rather annoying bug: sometimes when changing pages in the shop menu, it'd crash GZDoom or the menu would stop working. No matter how many null checks I added, it wouldn't make the bug disappear.
Recently I got fed up with this bug, and put GZDoom through a debugger. This showed almost much nothing, aside from the fact that it was crashing due to apparently accesses to freed memory.
While trying to figure it out, I realized that maybe it was something with the garbage collection... And apparently it is.
Here's an example PK3.
There's two ways to trigger this bug, one is through the shop menu and one is through the weapon assignment menu.
Common steps:
- Load the PK3.
- Start the game.
- Do "GC PAUSE 1", "GC STEPMUL 1000000" and "GC NOW" in the console. (In this order)
Shop menu:
- Bind the "Buy Menu" command and activate it or do "S7_LuciusShop" in the console.
- Click around on the items in the list on the left side of the screen.
Now either the menu will stop working, or the game will crash. If the former happens, you can click around the items list for a bit and it should crash.
Weapon assignment menu:
- Give yourself all items
- Bind the "Weap assign menu" command and activate it or do "S7_WeapMenu" in the console.
- Click on an empty/unused, non-blocked spot in the binds grid. This may or may not crash GZDoom.
- Click on a weapon in the list on the bottom of the screen.
GZDoom will then freeze for a bit and crash.
(Note: This also happens without messing around with the GC command. The only reason you're supposed to do it for this test PK3 is because it makes it much easier to reproduce the bug. Without doing that, it requires some luck to trigger the bug.)
While working on my mod, I stumbled upon a rather annoying bug: sometimes when changing pages in the shop menu, it'd crash GZDoom or the menu would stop working. No matter how many null checks I added, it wouldn't make the bug disappear.
Recently I got fed up with this bug, and put GZDoom through a debugger. This showed almost much nothing, aside from the fact that it was crashing due to apparently accesses to freed memory.
While trying to figure it out, I realized that maybe it was something with the garbage collection... And apparently it is.
[url=https://mega.nz/#!YGJ1XJiA!4fMHAtbKu6BgCF2tOCJpy3XOPEOqpA2TSJwlxuJVfys]Here's an example PK3[/url].
There's two ways to trigger this bug, one is through the shop menu and one is through the weapon assignment menu.
Common steps:
[list]
[*]Load the PK3.
[*]Start the game.
[*]Do "GC PAUSE 1", "GC STEPMUL 1000000" and "GC NOW" in the console. (In this order)[/list]
Shop menu:
[list]
[*]Bind the "Buy Menu" command and activate it or do "S7_LuciusShop" in the console.
[*]Click around on the items in the list on the left side of the screen.[/list]
Now either the menu will stop working, or the game will crash. If the former happens, you can click around the items list for a bit and it should crash.
Weapon assignment menu:
[list]
[*]Give yourself all items
[*]Bind the "Weap assign menu" command and activate it or do "S7_WeapMenu" in the console.
[*]Click on an empty/unused, non-blocked spot in the binds grid. This may or may not crash GZDoom.
[*]Click on a weapon in the list on the bottom of the screen.[/list]
GZDoom will then freeze for a bit and crash.
(Note: This also happens without messing around with the GC command. The only reason you're supposed to do it for this test PK3 is because it makes it much easier to reproduce the bug. Without doing that, it requires some luck to trigger the bug.)