Skip to content

Commit

Permalink
Revert "Fix possible crashes"
Browse files Browse the repository at this point in the history
This reverts commit a2010ee.
  • Loading branch information
alex-w committed Dec 9, 2023
1 parent a2010ee commit 8214683
Showing 1 changed file with 25 additions and 26 deletions.
51 changes: 25 additions & 26 deletions src/core/StelTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,36 +46,35 @@ StelTexture::StelTexture(StelTextureMgr *mgr)

StelTexture::~StelTexture()
{
if (id)
if (id != 0)
{
if (id != 0)
{
/// FS: make sure the correct GL context is bound!
/// Causes #595 flicker in Night Mode with DSS/HiPS. Tentatively remove this.
//StelApp::getInstance().ensureGLContextCurrent();
/// FS: make sure the correct GL context is bound!
/// Causes #595 flicker in Night Mode with DSS/HiPS. Tentatively remove this.
//StelApp::getInstance().ensureGLContextCurrent();

if (gl->glIsTexture(id)==GL_FALSE)
{
GLenum err = gl->glGetError();
qWarning() << "WARNING: in StelTexture::~StelTexture() tried to delete invalid texture with ID="
<< id << "Current GL ERROR status is" << err << "(" << StelOpenGL::getGLErrorText(err) << ")";
}
else
{
gl->glDeleteTextures(1, &id);
textureMgr->glMemoryUsage -= glSize;
textureMgr->idMap.remove(id);
glSize = 0;
}
#ifndef NDEBUG
if (qApp->property("verbose") == true)
qDebug() << "Deleted StelTexture" << id << ", total memory usage "
<< textureMgr->glMemoryUsage / (1024.0 * 1024.0)<<"MB";
#endif
id = 0;
if (gl->glIsTexture(id)==GL_FALSE)
{
GLenum err = gl->glGetError();
qWarning() << "WARNING: in StelTexture::~StelTexture() tried to delete invalid texture with ID="
<< id << "Current GL ERROR status is" << err << "(" << StelOpenGL::getGLErrorText(err) << ")";
}
else
qWarning()<<"Cannot delete texture"<<id<<", no GL context";
{
gl->glDeleteTextures(1, &id);
textureMgr->glMemoryUsage -= glSize;
textureMgr->idMap.remove(id);
glSize = 0;
}
#ifndef NDEBUG
if (qApp->property("verbose") == true)
qDebug() << "Deleted StelTexture" << id << ", total memory usage "
<< textureMgr->glMemoryUsage / (1024.0 * 1024.0)<<"MB";
#endif
id = 0;
}
else if (id)
{
qWarning()<<"Cannot delete texture"<<id<<", no GL context";
}
if (networkReply)
{
Expand Down

0 comments on commit 8214683

Please sign in to comment.