Scene is copied before being queued to avoid concurrence

preferencesAboutTextFull
Claudio Valerio 11 years ago
parent bea0740472
commit 5cea797ef1
  1. 6
      src/core/UBPersistenceManager.cpp
  2. 5
      src/core/UBPersistenceWorker.cpp
  3. 8
      src/domain/UBGraphicsScene.cpp

@ -738,7 +738,11 @@ void UBPersistenceManager::persistDocumentScene(UBDocumentProxy* pDocumentProxy,
if (pScene->isModified())
{
UBThumbnailAdaptor::persistScene(pDocumentProxy, pScene, pSceneIndex);
mWorker->saveScene(pDocumentProxy, pScene, pSceneIndex);
QTime time;
time.start();
UBGraphicsScene* copiedScene = pScene->sceneDeepCopy();
qDebug() << "time to duplicate scene " << time.elapsed() << " ms";
mWorker->saveScene(pDocumentProxy, copiedScene, pSceneIndex);
pScene->setModified(false);
}

@ -57,8 +57,11 @@ void UBPersistenceWorker::process()
mSemaphore.acquire();
do{
PersistenceInformation info = saves.takeFirst();
if(info.action == WriteScene)
if(info.action == WriteScene){
UBSvgSubsetAdaptor::persistScene(info.proxy, info.scene, info.sceneIndex);
delete info.scene;
info.scene = NULL;
}
else{
emit sceneLoaded(UBSvgSubsetAdaptor::loadSceneAsText(info.proxy,info.sceneIndex), info.proxy, info.sceneIndex);
}

@ -665,14 +665,6 @@ void UBGraphicsScene::DisposeMagnifierQWidgets()
magniferControlViewWidget = NULL;
}
if(magniferDisplayViewWidget)
{
magniferDisplayViewWidget->hide();
magniferDisplayViewWidget->setParent(0);
delete magniferDisplayViewWidget;
magniferDisplayViewWidget = NULL;
}
// some time have crash here on access to app (when call from destructor when close OpenBoard app)
// so i just add try/catch section here
try

Loading…
Cancel
Save