mirror of
https://github.com/glest/glest-source.git
synced 2025-09-08 23:10:42 +02:00
- fixed memory leaks in map editor, g3dviewer and the game
This commit is contained in:
@@ -284,7 +284,8 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
|
||||
wxSize(Renderer::windowW, Renderer::windowH)),
|
||||
model(NULL), glCanvas(NULL), renderer(NULL),
|
||||
initTextureManager(true), timer(NULL),
|
||||
startupSettingsInited(false)
|
||||
startupSettingsInited(false),
|
||||
fileDialog(NULL)
|
||||
{
|
||||
this->appPath = appPath;
|
||||
Properties::setApplicationPath(executable_path(appPath));
|
||||
@@ -531,6 +532,9 @@ MainWindow::~MainWindow(){
|
||||
delete timer;
|
||||
timer = NULL;
|
||||
|
||||
delete fileDialog;
|
||||
fileDialog = NULL;
|
||||
|
||||
delete model;
|
||||
model = NULL;
|
||||
|
||||
|
@@ -113,6 +113,11 @@ Renderer::~Renderer() {
|
||||
//resources
|
||||
delete particleManager;
|
||||
delete modelManager;
|
||||
|
||||
if(GraphicsInterface::getInstance().getFactory() != NULL) {
|
||||
delete GraphicsInterface::getInstance().getFactory();
|
||||
GraphicsInterface::getInstance().setFactory(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
Renderer * Renderer::getInstance() {
|
||||
@@ -174,8 +179,11 @@ Model * Renderer::getNewModel() {
|
||||
void Renderer::init() {
|
||||
assertGl();
|
||||
|
||||
GraphicsFactory *gf= new GraphicsFactoryGl();
|
||||
GraphicsInterface::getInstance().setFactory(gf);
|
||||
GraphicsFactory *gf= GraphicsInterface::getInstance().getFactory();
|
||||
if(gf == NULL) {
|
||||
gf= new GraphicsFactoryGl();
|
||||
GraphicsInterface::getInstance().setFactory(gf);
|
||||
}
|
||||
|
||||
modelRenderer= gf->newModelRenderer();
|
||||
textureManager= gf->newTextureManager();
|
||||
|
Reference in New Issue
Block a user