Skip to content

Commit 72d8b8f

Browse files
committed
Potentially harden against region teardown crash. Screw with branching to delve more information from callstacks since dynamic annotations don't seem to work with sentry.io using crashpad lib... sadface.
1 parent 4a237de commit 72d8b8f

2 files changed

Lines changed: 60 additions & 13 deletions

File tree

indra/newview/llsurface.cpp

Lines changed: 59 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#include "llglheaders.h"
5454
#include "lldrawpoolterrain.h"
5555
#include "lldrawable.h"
56+
#include "hippogridmanager.h"
5657

5758
extern LLPipeline gPipeline;
5859
extern bool gShiftFrame;
@@ -371,6 +372,14 @@ void LLSurface::connectNeighbor(LLSurface* neighborp, U32 direction)
371372
// - Non-power-of-2 regions should work here, but the rest of the viewer code will probably choke on them.
372373

373374
surface_patch_ref patchp, neighbor_patchp;
375+
if (mNeighbors[direction] == neighborp)
376+
{
377+
return;
378+
}
379+
if (mNeighbors[direction])
380+
{
381+
mNeighbors[direction]->disconnectNeighbor(this, gDirOpposite[direction]);
382+
}
374383
mNeighbors[direction] = neighborp;
375384

376385
const S32 max_idx = mPatchesPerEdge - 1;
@@ -480,33 +489,71 @@ void LLSurface::connectNeighbor(LLSurface* neighborp, U32 direction)
480489
}
481490
}
482491

483-
void LLSurface::disconnectNeighbor(LLSurface *surfacep)
492+
void LLSurface::disconnectNeighbor(LLSurface* surfacep, U32 direction)
484493
{
485-
S32 i;
486-
for (i = 0; i < 8; i++)
494+
if (surfacep && surfacep == mNeighbors[direction])
487495
{
488-
if (surfacep == mNeighbors[i])
496+
// Iterate through surface patches, removing any connectivity to removed surface.
497+
// Extra branches for debugging.
498+
if (!gHippoGridManager->getCurrentGrid()->isSecondLife())
489499
{
490-
mNeighbors[i] = NULL;
500+
for (auto& patchp : mPatchList)
501+
{
502+
patchp->disconnectNeighbor(surfacep);
503+
}
504+
}
505+
if (gHippoGridManager->getCurrentGrid()->isSecondLife())
506+
{
507+
for (auto& patchp : mPatchList)
508+
{
509+
patchp->disconnectNeighbor(surfacep);
510+
}
491511
}
492-
}
493-
494-
// Iterate through surface patches, removing any connectivity to removed surface.
495-
for (auto& patchp : mPatchList)
496-
{
497-
patchp->disconnectNeighbor(surfacep);
498512
}
499513
}
500514

501515

502516
void LLSurface::disconnectAllNeighbors()
503517
{
518+
// Pulled out of loop to debug.
519+
if (mNeighbors[EAST])
520+
{
521+
mNeighbors[EAST]->disconnectNeighbor(this, gDirOpposite[EAST]);
522+
}
523+
if (mNeighbors[NORTH])
524+
{
525+
mNeighbors[NORTH]->disconnectNeighbor(this, gDirOpposite[NORTH]);
526+
}
527+
if (mNeighbors[WEST])
528+
{
529+
mNeighbors[WEST]->disconnectNeighbor(this, gDirOpposite[WEST]);
530+
}
531+
if (mNeighbors[SOUTH])
532+
{
533+
mNeighbors[SOUTH]->disconnectNeighbor(this, gDirOpposite[SOUTH]);
534+
}
535+
if (mNeighbors[NORTHEAST])
536+
{
537+
mNeighbors[NORTHEAST]->disconnectNeighbor(this, gDirOpposite[NORTHEAST]);
538+
}
539+
if (mNeighbors[NORTHWEST])
540+
{
541+
mNeighbors[NORTHWEST]->disconnectNeighbor(this, gDirOpposite[NORTHWEST]);
542+
}
543+
if (mNeighbors[SOUTHWEST])
544+
{
545+
mNeighbors[SOUTHWEST]->disconnectNeighbor(this, gDirOpposite[SOUTHWEST]);
546+
}
547+
if (mNeighbors[SOUTHEAST])
548+
{
549+
mNeighbors[SOUTHEAST]->disconnectNeighbor(this, gDirOpposite[SOUTHEAST]);
550+
}
504551
S32 i;
505552
for (i = 0; i < 8; i++)
506553
{
507554
if (mNeighbors[i])
508555
{
509-
mNeighbors[i]->disconnectNeighbor(this);
556+
//mNeighbors[i]->disconnectNeighbor(this);
510557
mNeighbors[i] = NULL;
511558
}
512559
}

indra/newview/llsurface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class LLSurface
8585
void setOriginGlobal(const LLVector3d &origin_global);
8686

8787
void connectNeighbor(LLSurface *neighborp, U32 direction);
88-
void disconnectNeighbor(LLSurface *neighborp);
88+
void disconnectNeighbor(LLSurface *neighborp, U32 direction);
8989
void disconnectAllNeighbors();
9090

9191
// <FS:CR> Aurora Sim

0 commit comments

Comments
 (0)