Strange crash on exit

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
Nash
 
 
Posts: 17433
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Strange crash on exit

Post by Nash »

Simply having this loaded will crash GZDoom on exit. The code isn't even being called anywhere.

Code: Select all

version "2.5"

class LADString
{
    static String GetKeyName(String cmd)
    {
        int k1, k2;
        [k1, k2] = Bindings.GetKeysForCommand(cmd);
        return KeyBindings.NameKeys(k1, k2);
    }
}
 
Attachments
zscript.txt
(189 Bytes) Downloaded 33 times
User avatar
Nash
 
 
Posts: 17433
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Strange crash on exit

Post by Nash »

Discovered by TheZombieKiller:

If you add some kind of global function call, GZDoom won't crash on exit:

Code: Select all

class LADString
{
    clearscope static String GetKeyName(String cmd)
    {
        int k1, k2;
        [k1, k2] = Bindings.GetKeysForCommand(cmd);

        // adding this line will not COE GZDoom!
        AllActorClasses.Size();
        
        return KeyBindings.NameKeys(k1, k2);
    }
}
 
(the clearscope keyword doesn't change anything; it COEs both with and without)

Hope this helps.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Weird crash on startup related to multiple returns

Post by _mental_ »

We have a 'double free' issue in multiple assignment resolution code. Items in FxMultiAssign::Base are destructed twice.
The first one is in FxAssign::~FxAssign(), created in FxMultiAssign::Resolve() function.
The second one is in its own destructor becase FxMultiAssign::Base has FArgumentList type which in turn is TDeletingArray<FxExpression*>.

For me it's enough to define FxMultiAssign::Base as TArray<FxExpression*> Base; so its items will be owned and destructed in by FxAssign.
Graf, please let me know if you are OK with this fix.

EDIT: Another sample to reproduce the same crash but during startup is here.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Strange crash on exit

Post by _mental_ »

Fixed in 40a348b.
Post Reply

Return to “Closed Bugs [GZDoom]”