Commit bea07404 authored by -f's avatar -f

one scene document error when asking isEmpty. Load scene was called before persisted on disk

parent ccf7532a
...@@ -730,6 +730,8 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy, ...@@ -730,6 +730,8 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy,
QDir dir(pDocumentProxy->persistencePath()); QDir dir(pDocumentProxy->persistencePath());
dir.mkpath(pDocumentProxy->persistencePath()); dir.mkpath(pDocumentProxy->persistencePath());
mSceneCache.insert(pDocumentProxy, pSceneIndex, pScene);
if (pDocumentProxy->isModified()) if (pDocumentProxy->isModified())
UBMetadataDcSubsetAdaptor::persist(pDocumentProxy); UBMetadataDcSubsetAdaptor::persist(pDocumentProxy);
...@@ -740,7 +742,6 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy, ...@@ -740,7 +742,6 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy,
pScene->setModified(false); pScene->setModified(false);
} }
mSceneCache.insert(pDocumentProxy, pSceneIndex, pScene);
} }
...@@ -890,14 +891,15 @@ bool UBPersistenceManager::isEmpty(UBDocumentProxy* pDocumentProxy) ...@@ -890,14 +891,15 @@ bool UBPersistenceManager::isEmpty(UBDocumentProxy* pDocumentProxy)
if (pDocumentProxy->pageCount() > 1) if (pDocumentProxy->pageCount() > 1)
return false; return false;
UBGraphicsScene *theSoleScene = UBSvgSubsetAdaptor::loadScene(pDocumentProxy, 0); UBGraphicsScene *theSoleScene = mSceneCache.value(pDocumentProxy, 0) ? mSceneCache.value(pDocumentProxy, 0) : UBSvgSubsetAdaptor::loadScene(pDocumentProxy, 0);
bool empty = false; bool empty = false;
if (theSoleScene) if (theSoleScene)
{ {
empty = theSoleScene->isEmpty(); empty = theSoleScene->isEmpty();
delete theSoleScene; if(empty)
delete theSoleScene;
} }
else else
{ {
......
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