This will (hopefully) solve the memory leaks in dynamic ribbons and image button widgets
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
#include "utils/vs.hpp"
|
||||
|
||||
#include <IGUIEnvironment.h>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
@@ -45,6 +44,7 @@ DynamicRibbonWidget::DynamicRibbonWidget(const bool combo, const bool multi_row)
|
||||
m_check_inside_me = true;
|
||||
m_supports_multiplayer = true;
|
||||
m_scrolling_enabled = true;
|
||||
m_animated_contents = false;
|
||||
|
||||
// by default, set all players to have no selection in this ribbon
|
||||
for (unsigned int n=0; n<MAX_PLAYER_COUNT; n++)
|
||||
@@ -61,7 +61,7 @@ DynamicRibbonWidget::DynamicRibbonWidget(const bool combo, const bool multi_row)
|
||||
// -----------------------------------------------------------------------------
|
||||
DynamicRibbonWidget::~DynamicRibbonWidget()
|
||||
{
|
||||
m_font->drop();
|
||||
delete m_font;
|
||||
if (m_animated_contents)
|
||||
{
|
||||
GUIEngine::needsUpdate.remove(this);
|
||||
|
||||
@@ -293,8 +293,8 @@ video::ITexture* IconButtonWidget::getDeactivatedTexture(video::ITexture* textur
|
||||
u32 g;
|
||||
|
||||
video::IVideoDriver* driver = irr_driver->getVideoDriver();
|
||||
video::IImage* image = driver->createImageFromData (texture->getColorFormat(),
|
||||
texture->getSize(), texture->lock(), false);
|
||||
std::auto_ptr<video::IImage> image (driver->createImageFromData (texture->getColorFormat(),
|
||||
texture->getSize(), texture->lock(), false));
|
||||
texture->unlock();
|
||||
|
||||
//Turn the image into grayscale
|
||||
@@ -309,10 +309,7 @@ video::ITexture* IconButtonWidget::getDeactivatedTexture(video::ITexture* textur
|
||||
}
|
||||
}
|
||||
|
||||
texture = driver->addTexture(texture->getName().getPath() + "_disabled", image);
|
||||
image->drop();
|
||||
|
||||
return texture;
|
||||
return driver->addTexture(texture->getName().getPath() + "_disabled", image.get ());
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user