summaryrefslogtreecommitdiff
path: root/src/gui/widgets/scrollarea.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-08-28 22:45:19 +0300
committerAndrei Karas <akaras@inbox.ru>2013-08-29 00:18:57 +0300
commit3db999ff2d3324ffad6ba6a469ca224c8d864dc3 (patch)
tree78ecfd05c1267f7360e42876072ddb21efa1a096 /src/gui/widgets/scrollarea.cpp
parent57726c7324f165c70671fc5b05d6c0964f56b870 (diff)
downloadmanaplus-3db999ff2d3324ffad6ba6a469ca224c8d864dc3.tar.gz
manaplus-3db999ff2d3324ffad6ba6a469ca224c8d864dc3.tar.bz2
manaplus-3db999ff2d3324ffad6ba6a469ca224c8d864dc3.tar.xz
manaplus-3db999ff2d3324ffad6ba6a469ca224c8d864dc3.zip
add some more missing checks.
Diffstat (limited to 'src/gui/widgets/scrollarea.cpp')
-rw-r--r--src/gui/widgets/scrollarea.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index 98b58f51c..c21ddd17c 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -102,9 +102,9 @@ ScrollArea::~ScrollArea()
const Theme *const theme = Theme::instance();
if (theme)
{
- theme->unloadRect(background);
if (instances == 0)
{
+ theme->unloadRect(background);
theme->unloadRect(vMarker);
theme->unloadRect(vMarkerHi);
theme->unloadRect(vBackground);
@@ -135,12 +135,6 @@ void ScrollArea::init(std::string skinName)
setLeftButtonScrollAmount(2);
setRightButtonScrollAmount(2);
- if (skinName == "")
- skinName = "scroll_background.xml";
- Theme *const theme = Theme::instance();
- if (theme)
- theme->loadRect(background, skinName, "scroll_background.xml");
-
if (instances == 0)
{
for (int f = 0; f < 9; f ++)
@@ -152,6 +146,13 @@ void ScrollArea::init(std::string skinName)
hBackground.grid[f] = nullptr;
}
+ // +++ here probably need move background from static
+ if (skinName == "")
+ skinName = "scroll_background.xml";
+ Theme *const theme = Theme::instance();
+ if (theme)
+ theme->loadRect(background, skinName, "scroll_background.xml");
+
if (theme)
{
theme->loadRect(vMarker, "scroll.xml", "");
@@ -169,7 +170,8 @@ void ScrollArea::init(std::string skinName)
const ImageRect &rect = skin->getBorder();
for (int f = UP; f < BUTTONS_DIR; f ++)
{
- rect.grid[f]->incRef();
+ if (rect.grid[f])
+ rect.grid[f]->incRef();
buttons[f][i] = rect.grid[f];
}
if (i == 0)
@@ -188,7 +190,6 @@ void ScrollArea::init(std::string skinName)
}
}
mScrollbarWidth = mScrollbarSize;
-
instances++;
}