Commit 1f9e6bd8 authored by Clément Fauconnier's avatar Clément Fauconnier

fixed a crash where a scene was removed : the compactCache method has no more...

fixed a crash where a scene was removed : the compactCache method has no more sense now that we load each scene to create a view on it (thumbnail views)
parent 75ecc33b
......@@ -81,11 +81,6 @@ void UBSceneCache::insert (UBDocumentProxy* proxy, int pageIndex, UBGraphicsScen
}
else
{
if (mCachedSceneCount >= UBSettings::settings()->pageCacheSize->get().toInt())
{
compactCache();
}
QHash<UBSceneCacheID, UBGraphicsScene*>::insert(key, scene);
mCachedKeyFIFO.enqueue(key);
......@@ -231,41 +226,6 @@ void UBSceneCache::internalMoveScene(UBDocumentProxy* proxy, int sourceIndex, in
}
}
void UBSceneCache::compactCache()
{
bool foundUnusedScene = false;
int count = 0;
do
{
if (!mCachedKeyFIFO.isEmpty())
{
const UBSceneCacheID nextKey = mCachedKeyFIFO.dequeue();
if (QHash<UBSceneCacheID, UBGraphicsScene*>::contains(nextKey))
{
UBGraphicsScene* scene = QHash<UBSceneCacheID, UBGraphicsScene*>::value(nextKey);
if (scene && scene->views().size() == 0)
{
removeScene(nextKey.documentProxy, nextKey.pageIndex);
foundUnusedScene = true;
}
else
{
mCachedKeyFIFO.enqueue(nextKey);
}
}
}
count++;
}
while (!foundUnusedScene && count < mCachedKeyFIFO.size());
}
void UBSceneCache::dumpCacheContent()
{
foreach(UBSceneCacheID key, keys())
......
......@@ -107,8 +107,6 @@ class UBSceneCache : public QHash<UBSceneCacheID, UBGraphicsScene*>
void dumpCacheContent();
void compactCache();
int mCachedSceneCount;
QQueue<UBSceneCacheID> mCachedKeyFIFO;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment