fix leaks

This commit is contained in:
Eduardo Bart
2011-04-09 22:13:12 -03:00
parent 9d1ddf34bf
commit 5de660a20e
7 changed files with 42 additions and 16 deletions

View File

@@ -29,6 +29,7 @@
UIElement::UIElement(UI::EElementType type) :
AnchorLayout(),
m_type(type),
m_skin(NULL),
m_visible(true),
m_enabled(true)
{

View File

@@ -76,15 +76,15 @@ ImagePtr UIElementSkin::loadImage(const YAML::Node& node)
}
image = ImagePtr(new BorderedImage(texture,
left,
right,
top,
bottom,
topLeft,
topRight,
bottomLeft,
bottomRight,
center));
left,
right,
top,
bottom,
topLeft,
topRight,
bottomLeft,
bottomRight,
center));
}
return image;
}

View File

@@ -38,6 +38,7 @@ public:
UIElementSkin(const std::string& name, UI::EElementType elementType) :
m_name(name),
m_elementType(elementType) { }
virtual ~UIElementSkin() { }
virtual void load(const YAML::Node& node);
virtual void draw(UIElement *element);

View File

@@ -32,10 +32,18 @@
UISkins g_uiSkins;
UISkins::~UISkins()
void UISkins::init()
{
// load default skin
g_uiSkins.load("skins/tibiaskin.yml");
}
void UISkins::terminate()
{
for(auto it = m_elementSkins.begin(); it != m_elementSkins.end(); ++it)
delete (*it);
m_elementSkins.clear();
}
bool UISkins::load(const std::string& file)

View File

@@ -35,7 +35,9 @@ class UISkins
{
public:
UISkins() { }
~UISkins();
void init();
void terminate();
bool load(const std::string& file);