scene are deleted on gui thread

preferencesAboutTextFull
Claudio Valerio 11 years ago
parent 55a4b8601a
commit 422ab4c537
  1. 7
      src/core/UBPersistenceManager.cpp
  2. 1
      src/core/UBPersistenceManager.h
  3. 5
      src/core/UBPersistenceWorker.cpp
  4. 1
      src/core/UBPersistenceWorker.h

@ -86,6 +86,7 @@ UBPersistenceManager::UBPersistenceManager(QObject *pParent)
connect(mWorker, SIGNAL(finished()), mWorker, SLOT(deleteLater()));
connect(mThread, SIGNAL(finished()), mThread, SLOT(deleteLater()));
connect(mWorker,SIGNAL(sceneLoaded(QByteArray,UBDocumentProxy*,int)),this,SLOT(onSceneLoaded(QByteArray,UBDocumentProxy*,int)));
connect(mWorker,SIGNAL(scenePersisted(UBGraphicsScene*)),this,SLOT(onScenePersisted(UBGraphicsScene*)));
mThread->start();
}
@ -107,6 +108,12 @@ void UBPersistenceManager::destroy()
sSingleton = NULL;
}
void UBPersistenceManager::onScenePersisted(UBGraphicsScene* scene)
{
delete scene;
scene = NULL;
}
void UBPersistenceManager::onWorkerFinished()
{
mIsWorkerFinished = true;

@ -160,6 +160,7 @@ class UBPersistenceManager : public QObject
void errorString(QString error);
void onSceneLoaded(QByteArray,UBDocumentProxy*,int);
void onWorkerFinished();
void onScenePersisted(UBGraphicsScene* scene);
};

@ -63,8 +63,9 @@ void UBPersistenceWorker::process()
PersistenceInformation info = saves.takeFirst();
if(info.action == WriteScene){
UBSvgSubsetAdaptor::persistScene(info.proxy, info.scene, info.sceneIndex);
delete info.scene;
info.scene = NULL;
// delete info.scene;
// info.scene = NULL;
emit scenePersisted(info.scene);
}
else{
emit sceneLoaded(UBSvgSubsetAdaptor::loadSceneAsText(info.proxy,info.sceneIndex), info.proxy, info.sceneIndex);

@ -55,6 +55,7 @@ signals:
void finished();
void error(QString string);
void sceneLoaded(QByteArray text,UBDocumentProxy* proxy, const int pageIndex);
void scenePersisted(UBGraphicsScene* scene);
public slots:
void process();

Loading…
Cancel
Save