--- a/src/hbcore/image/hbframedrawer.cpp Thu Sep 02 20:44:51 2010 +0300
+++ b/src/hbcore/image/hbframedrawer.cpp Fri Sep 17 08:32:10 2010 +0300
@@ -247,8 +247,13 @@
HbFrameDrawerPrivate::~HbFrameDrawerPrivate()
{
unLoadIcon();
- //Unregister the HbFrameDrawerPrivate Instance to HbIconLoader
- HbIconLoader::global()->removeFrameDrawerInfo(this);
+ // Unregister the HbFrameDrawerPrivate Instance to HbIconLoader.
+ // However it may already have been destroyed, if the app is shuting down
+ // so be prepared for null ptr too.
+ HbIconLoader *loader = HbIconLoader::global();
+ if (loader) {
+ loader->removeFrameDrawerInfo(this);
+ }
}
/*!
@@ -371,6 +376,9 @@
// Create the frame icon and add it in the icon cache
HbIconLoader *loader = HbIconLoader::global();
+ if (!loader) {
+ return;
+ }
//If it's one-piece frame-item, it's loaded using HbIconLoader::loadIcon()
if (frameParts == 1) {
@@ -397,8 +405,8 @@
//For multi-piece frame-items, HbIocnLoader::loadMultipieceIcon is used
//This function returns the consolidate (stitched) icon created on the themeserver.
- //If the consolidated icon-creation on themeserver fails, then server returns a list
- //of individual frame-items.
+ //If the consolidated icon-creation on themeserver fails, then the consolidated
+ //icon is created on the client-side (fallback)
HbIconImpl *iconImpl = loader->loadMultiPieceIcon(multiPieceFileNames, data, frameIconSize,
Qt::IgnoreAspectRatio, QIcon::Normal, iconLoaderOptions(),
listOfIcons, color);
@@ -1067,7 +1075,9 @@
if (icon) {
//If a consolidated (stitched) icon was created on the themeserver, then
//HbIconLoader::unloadIcon() is used to unload it.
- loader->unLoadIcon(icon->iconImpl(), unloadedByServer);
+ if (loader) {
+ loader->unLoadIcon(icon->iconImpl(), unloadedByServer);
+ }
icon->dispose();
icon = 0;
}
@@ -1095,6 +1105,8 @@
fallbackMaskableIconList.clear(); // vector of HbMaskableIconImpl*
}
+// This is called from HbIconLoader when building for tools.
+// It is not in use in normal builds.
void HbFrameDrawerPrivate::themeChange(const QStringList &updatedFiles)
{
bool unloadIcons = false;
@@ -1345,7 +1357,8 @@
{
const_cast<HbFrameDrawer *>(this)->setRect(rect);
- if (d->frameGraphicsName.isEmpty() || d->type == HbFrameDrawer::Undefined || d->rect.isEmpty()) {
+ HbIconLoader *loader = HbIconLoader::global();
+ if (d->frameGraphicsName.isEmpty() || d->type == HbFrameDrawer::Undefined || d->rect.isEmpty() || !loader) {
return;
}
@@ -1358,7 +1371,7 @@
// update the rendering mode
QPaintEngine *paintEngine = painter->paintEngine();
if (paintEngine) {
- HbIconLoader::global()->updateRenderingMode(paintEngine->type());
+ loader->updateRenderingMode(paintEngine->type());
}
d->prepareFrameIcon();
d->prevRect = rect.toRect();
@@ -1598,7 +1611,8 @@
/*!
* This function should be called when the theme changes. This clears the used frame
-* graphic.
+* graphics. This is typically handled by HbFrameItem so there is no need to call this function
+* manually when using the framedrawer with a HbFrameItem.
*/
void HbFrameDrawer::themeChanged()
{