diff options
author | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-11-03 16:37:26 +0100 |
---|---|---|
committer | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-11-03 18:43:14 +0100 |
commit | 64a5c7d34a2909c8c39a40d4d2f18fa8c7b2d486 (patch) | |
tree | 7c367e34c131a8e83093c767c7b9fe68954d24b9 | |
parent | 0ce4c047e9c763b654ac08a7bd0439aa7e055f35 (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
-rw-r--r-- | include/svtools/grfmgr.hxx | 2 | ||||
-rw-r--r-- | svtools/source/graphic/grfmgr.cxx | 2 | ||||
-rw-r--r-- | svtools/source/graphic/grfmgr2.cxx | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/include/svtools/grfmgr.hxx b/include/svtools/grfmgr.hxx index d4522768b199..a8c391c0791a 100644 --- a/include/svtools/grfmgr.hxx +++ b/include/svtools/grfmgr.hxx @@ -615,7 +615,7 @@ private: // For 32Bit systems this leads to situations where graphics will be missing. This method will actively swap out // the longest swapped in graphics until a maximum memory boundary (derived from user settings in tools/options/memory) // is no longer exceeded - void SVT_DLLPRIVATE ImplCheckSizeOfSwappedInGraphics(); + void SVT_DLLPRIVATE ImplCheckSizeOfSwappedInGraphics(const GraphicObject* pGraphicToIgnore); public: GraphicManager( sal_uLong nCacheSize = 10000000UL, sal_uLong nMaxObjCacheSize = 2400000UL ); diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx index 45367cd418f3..a6de6972211d 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 57a1620d5fa7..5c39c7a9ca49 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(); |