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

preferencesAboutTextFull
-f 11 years ago
parent ccf7532af8
commit bea0740472
  1. 6
      src/core/UBPersistenceManager.cpp

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

Loading…
Cancel
Save