summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-11-03 16:37:26 +0100
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-11-07 10:45:09 +0100
commit5c2ec558ac5bbe76a0070cee90c3ff9ce0544a87 (patch)
treef27f0007e8b9e49ab55b49758da5518480637349 /svtools
parentccdf558157b7e1b31d8bfd7cce45468f5013fb6d (diff)
Avoid an image loss situation of auto swapping
Before an image data is used GraphicObject should be swapped in. When a GraphicObject is swapped in auto swapping mechanism is triggered which can swap out some of the images. We should avoid to swap out the same image on which the swap in method was called before because the caller code assumes that the image data is there. Change-Id: Ia4addc370742aea5fbf185cf87e3c062a5ebf5be
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/graphic/grfmgr.cxx2
-rw-r--r--svtools/source/graphic/grfmgr2.cxx4
2 files changed, 3 insertions, 3 deletions
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
index 2c4746d7ed16..e3fa83ff3275 100644
--- a/svtools/source/graphic/grfmgr.cxx
+++ b/svtools/source/graphic/grfmgr.cxx
@@ -70,7 +70,7 @@ void GraphicObject::ImplAfterDataChange()
// check memory footprint of all GraphicObjects managed and evtl. take action
if (mpMgr)
- mpMgr->ImplCheckSizeOfSwappedInGraphics();
+ mpMgr->ImplCheckSizeOfSwappedInGraphics(this);
}
GraphicObject::GraphicObject( const GraphicManager* pMgr ) :
diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx
index b61f079d39d2..c97a0438f0da 100644
--- a/svtools/source/graphic/grfmgr2.cxx
+++ b/svtools/source/graphic/grfmgr2.cxx
@@ -192,7 +192,7 @@ namespace
};
} // end of anonymous namespace
-void GraphicManager::ImplCheckSizeOfSwappedInGraphics()
+void GraphicManager::ImplCheckSizeOfSwappedInGraphics(const GraphicObject* pGraphicToIgnore)
{
// get the currently used memory footprint of all swapped in bitmap graphics
// of this graphic manager. Remember candidates in a vector. The size in bytes is
@@ -205,7 +205,7 @@ void GraphicManager::ImplCheckSizeOfSwappedInGraphics()
for (size_t i = 0, n = maObjList.size(); i < n; ++i)
{
pObj = maObjList[i];
- if (pObj->meType == GRAPHIC_BITMAP && !pObj->IsSwappedOut() && pObj->GetSizeBytes())
+ if (pObj->meType == GRAPHIC_BITMAP && !pObj->IsSwappedOut() && pObj->GetSizeBytes() && pObj != pGraphicToIgnore)
{
aCandidates.push_back(pObj);
size_t const nSize = pObj->GetSizeBytes();