summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-07-12 11:01:25 +0300
committerAndrei Karas <akaras@inbox.ru>2012-07-13 01:02:41 +0300
commit14a9a1da30ca772efd42a9ce6662a11b102818bc (patch)
treed19264fc77a677b0a25e989119dfbddb1ff14773 /src/gui/widgets
parentf42921c0597101b5d6f10afa68d0ffc6f6d1a66f (diff)
downloadplus-14a9a1da30ca772efd42a9ce6662a11b102818bc.tar.gz
plus-14a9a1da30ca772efd42a9ce6662a11b102818bc.tar.bz2
plus-14a9a1da30ca772efd42a9ce6662a11b102818bc.tar.xz
plus-14a9a1da30ca772efd42a9ce6662a11b102818bc.zip
Fix leaks after last commit.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/button.cpp6
-rw-r--r--src/gui/widgets/dropdown.cpp13
-rw-r--r--src/gui/widgets/playerbox.cpp2
-rw-r--r--src/gui/widgets/progressbar.cpp5
-rw-r--r--src/gui/widgets/resizegrip.cpp3
-rw-r--r--src/gui/widgets/scrollarea.cpp15
-rw-r--r--src/gui/widgets/slider.cpp6
-rw-r--r--src/gui/widgets/tab.cpp6
-rw-r--r--src/gui/widgets/textfield.cpp2
-rw-r--r--src/gui/widgets/window.cpp5
10 files changed, 62 insertions, 1 deletions
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index ba789f2c5..15b4abdc2 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -191,6 +191,12 @@ Button::~Button()
{
mInstances--;
+ if (mInstances == 0 && Theme::instance())
+ {
+ Theme *theme = Theme::instance();
+ for (int mode = 0; mode < BUTTON_COUNT; mode ++)
+ theme->unloadRect(button[mode]);
+ }
delete mVertexes;
mVertexes = nullptr;
if (mImageSet)
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 8727f940f..8b5f81e6b 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -115,6 +115,19 @@ DropDown::DropDown(gcn::ListModel *listModel, gcn::ActionListener* listener,
DropDown::~DropDown()
{
instances--;
+ if (instances == 0)
+ {
+ for (int f = 0; f < 2; f ++)
+ {
+ for (int i = 0; i < 2; i ++)
+ {
+ if (buttons[f][i])
+ buttons[f][i]->decRef();
+ }
+ }
+ if (Theme::instance())
+ Theme::instance()->unloadRect(skin);
+ }
delete mScrollArea;
mScrollArea = nullptr;
}
diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp
index d505aa27e..bf17793f5 100644
--- a/src/gui/widgets/playerbox.cpp
+++ b/src/gui/widgets/playerbox.cpp
@@ -60,6 +60,8 @@ PlayerBox::PlayerBox(Being *being):
PlayerBox::~PlayerBox()
{
instances--;
+ if (instances == 0 && Theme::instance())
+ Theme::instance()->unloadRect(background);
mBeing = nullptr;
}
diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp
index d4492a2b6..2ddd2b0b9 100644
--- a/src/gui/widgets/progressbar.cpp
+++ b/src/gui/widgets/progressbar.cpp
@@ -84,7 +84,10 @@ ProgressBar::ProgressBar(float progress,
ProgressBar::~ProgressBar()
{
mInstances--;
-
+ if (mInstances == 0 && Theme::instance())
+ {
+ Theme::instance()->unloadRect(mBorder);
+ }
delete mVertexes;
mVertexes = nullptr;
}
diff --git a/src/gui/widgets/resizegrip.cpp b/src/gui/widgets/resizegrip.cpp
index 98df17d12..4b299a5dc 100644
--- a/src/gui/widgets/resizegrip.cpp
+++ b/src/gui/widgets/resizegrip.cpp
@@ -44,6 +44,7 @@ ResizeGrip::ResizeGrip(const std::string &image)
{
// Load the grip image
gripImage = Theme::getImageFromThemeXml(image);
+
if (gripImage)
gripImage->setAlpha(mAlpha);
}
@@ -65,6 +66,8 @@ ResizeGrip::ResizeGrip(const std::string &image)
ResizeGrip::~ResizeGrip()
{
mInstances--;
+ if (mInstances == 0 && gripImage)
+ gripImage->decRef();
}
void ResizeGrip::draw(gcn::Graphics *graphics)
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index 4e15bc167..4cc4cad41 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -92,6 +92,21 @@ ScrollArea::~ScrollArea()
delete getContent();
instances--;
+ if (instances == 0 && Theme::instance())
+ {
+ Theme *theme = Theme::instance();
+ theme->unloadRect(background);
+ theme->unloadRect(vMarker);
+ theme->unloadRect(vMarkerHi);
+ for (int i = 0; i < 2; i ++)
+ {
+ for (int f = UP; f < BUTTONS_DIR; f ++)
+ {
+ if (buttons[f][i])
+ buttons[f][i]->decRef();
+ }
+ }
+ }
delete mVertexes;
mVertexes = nullptr;
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index 595b2f85d..6b5ad28a4 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -61,6 +61,12 @@ Slider::Slider(double scaleStart, double scaleEnd):
Slider::~Slider()
{
mInstances--;
+ if (mInstances == 0 && Theme::instance())
+ {
+ Theme *theme = Theme::instance();
+ for (int mode = 0; mode < 2; mode ++)
+ theme->unloadRect(buttons[mode]);
+ }
}
void Slider::init()
diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp
index f7b353c7e..d2236c1d8 100644
--- a/src/gui/widgets/tab.cpp
+++ b/src/gui/widgets/tab.cpp
@@ -78,6 +78,12 @@ Tab::Tab() :
Tab::~Tab()
{
mInstances--;
+ if (mInstances == 0 && Theme::instance())
+ {
+ Theme *theme = Theme::instance();
+ for (int mode = 0; mode < TAB_COUNT; mode ++)
+ Theme::instance()->unloadRect(tabImg[mode]);
+ }
delete mVertexes;
mVertexes = nullptr;
}
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index 4b71bd795..8f543e3bf 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -83,6 +83,8 @@ TextField::TextField(const std::string &text, bool loseFocusOnTab,
TextField::~TextField()
{
instances--;
+ if (instances == 0 && Theme::instance())
+ Theme::instance()->unloadRect(skin);
}
void TextField::updateAlpha()
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index d956e9adf..d2ba03e07 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -339,6 +339,11 @@ void Window::setResizable(bool r)
if (r)
{
+ if (mGrip)
+ {
+ remove(mGrip);
+ delete mGrip;
+ }
mGrip = new ResizeGrip;
mGrip->setX(getWidth() - mGrip->getWidth() - getChildrenArea().x);
mGrip->setY(getHeight() - mGrip->getHeight() - getChildrenArea().y);