- fixed: The skybox pointer in FSectorPortal must at least be initialized to nullptr when the struct is deserialized, to avoid an access violation if the partially initialized data is used. This can happen when P_SerializeThinkers destroys the original thinkers that were created on map load.

- removed the sector loop for deleting skybox references in ASkyViewpoint::Destroy. Since this only refers to the sectorPortals array it is completely redundant as the following code will clear them just as well.
This commit is contained in:
Christoph Oelckers 2016-05-13 10:07:01 +02:00
parent 4998d4a84d
commit cd8213f067
3 changed files with 4 additions and 9 deletions

View file

@ -59,13 +59,6 @@ void ASkyViewpoint::BeginPlay ()
void ASkyViewpoint::Destroy ()
{
// remove all sector references to ourselves.
for (int i = 0; i < numsectors; i++)
{
if (sectors[i].GetPortal(sector_t::floor)->mSkybox == this)
sectors[i].ClearPortal(sector_t::floor);
if (sectors[i].GetPortal(sector_t::ceiling)->mSkybox == this)
sectors[i].ClearPortal(sector_t::ceiling);
}
for (auto &s : sectorPortals)
{
if (s.mSkybox == this) s.mSkybox = 0;

View file

@ -231,6 +231,10 @@ FArchive &operator<< (FArchive &arc, FSectorPortal &port)
<< port.mDestination
<< port.mDisplacement
<< port.mPlaneZ;
if (arc.IsLoading())
{
port.mSkybox = nullptr;
}
return arc;
}

View file

@ -191,7 +191,6 @@ struct FLinePortal
double mSinRot;
double mCosRot;
portnode_t *render_thinglist;
void *mRenderData;
};
extern TArray<FLinePortal> linePortals;
@ -229,7 +228,6 @@ struct FSectorPortal
DVector2 mDisplacement;
double mPlaneZ;
TObjPtr<AActor> mSkybox;
void *mRenderData;
bool MergeAllowed() const
{