From 2e79aefc2fcb0d6d2c618c04eef8d7e5ca236ed4 Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 20 May 2016 13:01:23 +0200 Subject: [PATCH] + issue #0002521: SIGSEGV when trying to revert to saved file. --- src/App/Document.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/App/Document.cpp b/src/App/Document.cpp index 2afa28943..854f56a8d 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -1468,10 +1468,13 @@ void Document::restore (void) // clean up if the document is not empty // !TODO mind exeptions while restoring! clearUndos(); + // first notify the objects to being deleted and then delete them in a second loop (#0002521) + // FIXME: To delete every object individually is inefficient. Add a new signal 'signalClear' + // and then clear everything in one go. for (std::vector::iterator obj = d->objectArray.begin(); obj != d->objectArray.end(); ++obj) { - // NOTE don't call unsetupObject () here due to it is intended to do some manipulations - // on other objects, but here we are wiping out document completely signalDeletedObject(*(*obj)); + } + for (std::vector::iterator obj = d->objectArray.begin(); obj != d->objectArray.end(); ++obj) { delete *obj; } d->objectArray.clear();