r23957 by jghali - Fix double free caused by ScribusMainWindow's emergencySave()
scribus-commit
scribus-commit at lists.scribus.net
Tue Jul 28 22:57:40 UTC 2020
Author: jghali
Date: Tue Jul 28 22:57:40 2020
New Revision: 23957
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23957
Log:
Fix double free caused by ScribusMainWindow's emergencySave()
Modified:
trunk/Scribus/scribus/scribus.cpp
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23957&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Tue Jul 28 22:57:40 2020
@@ -8565,7 +8565,7 @@
void ScribusMainWindow::emergencySave()
{
- emergencyActivated=true;
+ emergencyActivated = true;
if (!m_prefsManager.appPrefs.miscPrefs.saveEmergencyFile)
return;
std::cout << "Calling Emergency Save" << std::endl;
@@ -8574,7 +8574,7 @@
return;
int windowCount = windows.count();
- for (int i=0; i<windowCount ; ++i)
+ for (int i = 0; i < windowCount; ++i)
{
ActWin = dynamic_cast<ScribusWin*>(windows.at(i)->widget());
doc = ActWin->doc();
@@ -8598,12 +8598,9 @@
std::cout << "Saving: " << fileName.toStdString() << std::endl;
FileLoader fl(fileName);
fl.saveFile(fileName, doc, nullptr);
- view->close();
- int numPages = doc->Pages->count();
- for (int j = 0; j < numPages; ++j)
- delete doc->Pages->at(j);
- delete doc;
- ActWin->close();
+ // ActWin->close() will trigger ScribusWin::closeEvent()
+ // so no need to manually close view or delete doc
+ ActWin->getSubWin()->close();
}
}
More information about the scribus-commit
mailing list