Page 2 of 2

Re: Supermodel crashes after quit

PostPosted: Sun Mar 12, 2023 2:43 pm
by rokfpoewrkcpoqwkcp
Not sure if you got this fixed but...

You have some overlapping /contradictory ini settings.(Looks like you're using Sega Model 3 UI.)
Code: Select all
[Info]    New3DEngine=1
[Info]    QuadRendering=1

Code: Select all
[Info]    WideScreen=0
[Info]    Stretch=1

Code: Select all
[Info]    Network=0
[Info]    SimulateNet=0
[Info]    PortIn=1970
[Info]    PortOut=1971
[Info]    AddressOut=127.0.0.1

[Info]    port_in=1970
[Info]    port_out=1971
[Info]    addr_out=127.0.0.1
[Info]    EmulateNet=0


To work out if your install is borked I would try the following:
Try using a fresh 'official' release in a different directory to your current install.
Do not copy any settings from your old install, use the new Supermodel.exe, Supermodel.ini and Games.xml
Launch using the command line, not a GUI.

If Supermodel does crash on exit, it may be invisible to you, but your NVRAMs probably aren't being saved?

Re: Supermodel crashes after quit

PostPosted: Mon Mar 13, 2023 6:48 am
by Juttar
Ian wrote:My best guess is the destructor for the netboard is doing something bad. Freeing memory that's already gone or possibly heap corruption.

Um ... err ... I'm afraid you're right. :?

Re: Supermodel crashes after quit

PostPosted: Tue Mar 14, 2023 11:38 am
by Bart
Ian was correct. There were two things, and one of them was a compiler warning that was being overlooked. First, there was a memory buffer being deallocated that was never allocated in the first place (it was commented out -- a reminder that leaving commented out code checked in is a really bad idea) and the second, which actually caused the crash, was that an invalid destructor was being called. INetBoard needed a virtual destructor.

NetBoard.cpp is in dire need of a clean up and re-formatting. We probably should adopt a coding style and start slowly converting everything to adhere to it. Commented out code in Supermodel usually represents some lost knowledge -- it was there because of a hypothesis about how something worked and then removed temporarily and forgotten. Probably best to type up long-form notes at the top of the file about how things work and what was tried, and then delete stale code altogether.

Re: Supermodel crashes after quit

PostPosted: Tue Mar 14, 2023 2:13 pm
by Ian
It's safe to delete a null pointer. You don't need additional checks since delete already checks.

Re: Supermodel crashes after quit

PostPosted: Tue Mar 14, 2023 5:22 pm
by Bart
Ian wrote:It's safe to delete a null pointer. You don't need additional checks since delete already checks.


Did not know that! That explains why that alone didn't cause a crash. And it makes sense.

Re: Supermodel crashes after quit

PostPosted: Tue Mar 14, 2023 5:34 pm
by Juttar
I'm glad. :)