Polyobj_OR_MoveToSpot Crash/Lockup
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.
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.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49234
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Polyobj_OR_MoveToSpot Crash/Lockup
Thanks for this analysis. I expected something along these lines.
- Tapwave
- Posts: 2096
- Joined: Sat Aug 20, 2011 8:54 am
- Preferred Pronouns: No Preference
- Graphics Processor: nVidia with Vulkan support
Re: Polyobj_OR_MoveToSpot Crash/Lockup
Blzut3 wrote:appears to be line 666 of po_man.cpp

-
- Posts: 1774
- Joined: Sat Oct 17, 2009 9:40 am
Re: Polyobj_OR_MoveToSpot Crash/Lockup
Hmm, I did this change:
Now in debug mode I have a failed assertion when I push the button:
seems like 'pe' can't be deleted normally. How is it done?
Code: Select all
Index: src/po_man.cpp
===================================================================
--- src/po_man.cpp (revision 3399)
+++ src/po_man.cpp (working copy)
@@ -618,7 +618,7 @@
bool EV_MovePolyTo(line_t *line, int polyNum, int speed, fixed_t targx, fixed_t targy, bool overRide)
{
int mirror;
- DMovePolyTo *pe;
+ DMovePolyTo *pe = NULL;
FPolyObj *poly;
TVector2<double> dist;
double distlen;
@@ -652,6 +652,8 @@
{
pe->StopInterpolation();
}
+ delete pe;
+ pe = NULL;
while ( (mirror = poly->GetMirror()) )
{
@@ -677,6 +679,8 @@
{
pe->StopInterpolation();
}
+ delete pe;
+ pe = NULL;
}
return true;
}
Code: Select all
zdoom: /media/27522720-b102-4f44-b9ed-8a24d4ef0738/edward-san/zdoom/trunk/src/dthinker.cpp:229: virtual DThinker::~DThinker(): Assertion `NextThinker == __null && PrevThinker == __null' failed.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49234
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Polyobj_OR_MoveToSpot Crash/Lockup
pe->Destroy() instead of delete pe;
In general any thinker object in the game may never plainly be 'delete'd.
You have to take care of internal references somehow and the destructor is not the correct spot for this. The object first needs to be garbage collected to ensure that it isn't referenced anymore.
In general any thinker object in the game may never plainly be 'delete'd.
You have to take care of internal references somehow and the destructor is not the correct spot for this. The object first needs to be garbage collected to ensure that it isn't referenced anymore.
-
- Posts: 1774
- Joined: Sat Oct 17, 2009 9:40 am
Re: Polyobj_OR_MoveToSpot Crash/Lockup
After that change the freeze is still there but it's a lot easier to stop the application. I still wonder why there's the loop (surely there's a missing assumption in the while loop).
[edit]Interestingly, 'mirror' oscillates between 2 and 1 ...
[edit]Interestingly, 'mirror' oscillates between 2 and 1 ...
-
-
- Posts: 3211
- Joined: Wed Nov 24, 2004 12:59 pm
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Contact:
Re: Polyobj_OR_MoveToSpot Crash/Lockup
The loop is there to potentially allow more than 2 polyobjs to be chained together. (Polyobj 1 has polyobj 2 as a mirror and polyobj 2 has polyobj 3 as a mirror for example.) However it is common practice for mirror polyobjs to have the source polyobj as it's mirror creating a cycle. This normally isn't a problem as ZDoom will break the loop when it hits a polyobj that's already active, but when using the override functions it just cycles indefinitely.
I think this also points out another minor bug in the non-override functions. Since it breaks on the first mirror to have an active thinker. You could possibly jam the non-override functions when used on a non cyclic set of polyobjs. Haven't actually tried this though.
I think this also points out another minor bug in the non-override functions. Since it breaks on the first mirror to have an active thinker. You could possibly jam the non-override functions when used on a non cyclic set of polyobjs. Haven't actually tried this though.
Re: Polyobj_OR_MoveToSpot Crash/Lockup
Fixed.
I don't know if this statement is actually true now or not, but common practice in Hexen was that only one polyobject was marked with a mirror, so you wouldn't get cycles like this.Blzut3 wrote:However it is common practice for mirror polyobjs to have the source polyobj as it's mirror creating a cycle.