Skip to content

Commit

Permalink
Fixed|Gloom|Client: Crash after dismissing fatal error message box
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Feb 25, 2020
1 parent 6e08684 commit af1ca2e
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
3 changes: 2 additions & 1 deletion doomsday/apps/client/src/render/modelloader.cpp
Expand Up @@ -109,7 +109,8 @@ DE_PIMPL(ModelLoader)
#endif
// Everything should have been unloaded, because all models
// have been destroyed at this point.
DE_ASSERT(empty());
// (Does not apply during abnormal shutdown.)
//DE_ASSERT(empty());
}
};
Programs programs;
Expand Down
2 changes: 2 additions & 0 deletions doomsday/libs/gloom/include/gloom/render/render.h
Expand Up @@ -33,6 +33,8 @@ class Render
Render();
virtual ~Render();

bool isInitialized() const;

const Context &context() const;
Context &context();

Expand Down
4 changes: 3 additions & 1 deletion doomsday/libs/gloom/src/render/lightrender.cpp
Expand Up @@ -424,8 +424,10 @@ void LightRender::render()
}
}

void LightRender::advanceTime(TimeSpan elapsed)
void LightRender::advanceTime(TimeSpan /*elapsed*/)
{
DE_ASSERT(isInitialized());

// Pick the shadow casters.
d->selectShadowCasters();

Expand Down
2 changes: 2 additions & 0 deletions doomsday/libs/gloom/src/render/maprender.cpp
Expand Up @@ -243,6 +243,8 @@ void MapRender::setPlaneY(ID planeId, double destY, double srcY, double startTim

void MapRender::advanceTime(TimeSpan elapsed)
{
DE_ASSERT(isInitialized());

d->lights.advanceTime(elapsed);

// Testing: Scroll offsets.
Expand Down
6 changes: 5 additions & 1 deletion doomsday/libs/gloom/src/render/render.cpp
Expand Up @@ -34,6 +34,11 @@ Render::~Render()
DE_ASSERT(d->context == nullptr);
}

bool Render::isInitialized() const
{
return d->context != nullptr;
}

const Context &Render::context() const
{
DE_ASSERT(d->context);
Expand All @@ -54,7 +59,6 @@ void Render::glInit(Context &context)

void Render::glDeinit()
{
DE_ASSERT(d->context != nullptr);
d->context = nullptr;
}

Expand Down
12 changes: 8 additions & 4 deletions doomsday/libs/gloom/src/world.cpp
Expand Up @@ -137,6 +137,7 @@ DE_PIMPL(World), public Asset

~Impl() override
{
glDeinit();
for (auto &a : textureAtlas) delete a;
}

Expand Down Expand Up @@ -296,10 +297,13 @@ void World::glDeinit()

void World::update(TimeSpan elapsed)
{
d->update(elapsed);
d->environ.advanceTime(elapsed);
d->mapRender.advanceTime(elapsed);
d->tonemap.advanceTime(elapsed);
if (d->isReady())
{
d->update(elapsed);
d->environ.advanceTime(elapsed);
d->mapRender.advanceTime(elapsed);
d->tonemap.advanceTime(elapsed);
}
}

void World::render(const ICamera &camera)
Expand Down

0 comments on commit af1ca2e

Please sign in to comment.