Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exit crash when built for GLES2 on Linux #5118

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <stdlib.h>
#include "SIrrCreationParameters.h"
#include "COpenGLExtensionHandler.h"
#include "COGLES2Driver.h"

#include "guiengine/engine.hpp"
#include "ge_main.hpp"
Expand Down Expand Up @@ -240,6 +241,12 @@ CIrrDeviceSDL::~CIrrDeviceSDL()
irr::video::COpenGLExtensionHandler* h = dynamic_cast<irr::video::COpenGLExtensionHandler*>(VideoDriver);
if (h)
h->clearGLExtensions();
#endif
#ifdef _IRR_COMPILE_WITH_OGLES2_
irr::video::COGLES2Driver* es2 = dynamic_cast<irr::video::COGLES2Driver*>(VideoDriver);
if (es2) {
es2->cleanUp();
}
#endif
GE::GEVulkanDriver* gevk = dynamic_cast<GE::GEVulkanDriver*>(VideoDriver);
if (gevk)
Expand Down
4 changes: 1 addition & 3 deletions lib/irrlicht/source/Irrlicht/COGLES2Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@ namespace video
//! destructor
COGLES2Driver::~COGLES2Driver()
{
deleteMaterialRenders();
delete MaterialRenderer2D;
deleteAllTextures();
cleanUp();

if (BridgeCalls)
delete BridgeCalls;
Expand Down
10 changes: 10 additions & 0 deletions lib/irrlicht/source/Irrlicht/COGLES2Driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ namespace irr
#include "EDriverFeatures.h"
#include "fast_atof.h"
#include "COGLES2ExtensionHandler.h"
#include "COGLES2Renderer2D.h"

class ContextManagerEGL;

Expand Down Expand Up @@ -397,6 +398,15 @@ namespace video
ContextManagerEGL* getEGLContext() {return EglContext;}
#endif

void cleanUp() {
deleteMaterialRenders();
if (MaterialRenderer2D) {
delete MaterialRenderer2D;
MaterialRenderer2D = NULL;
}
deleteAllTextures();
}

private:
// Bridge calls.
COGLES2CallBridge* BridgeCalls;
Expand Down
Loading