Fix crash on exit in YACReader. The problem was the default texture in the flow being deleted more than once.

This commit is contained in:
Luis Ángel San Martín 2018-01-02 21:12:32 +01:00
parent c490e48c00
commit 7e106aedd9
2 changed files with 16 additions and 2 deletions

View File

@ -165,6 +165,8 @@ int main(int argc, char * argv[])
int ret = app.exec();
delete mwv;
//Configuration::getConfiguration().save();
YACReader::exitCheck(ret);

View File

@ -1341,8 +1341,20 @@ YACReaderPageFlowGL::~YACReaderPageFlowGL()
this->killTimer(timerId);
//worker->deleteLater();
rawImages.clear();
for(int i = 0;i<numObjects;i++){
delete(images[i].texture);
//TODO: remove checking for a valid context
//checking is needed because of this bug this bug: https://bugreports.qt.io/browse/QTBUG-60148
if (this->context() != nullptr && this->context()->isValid())
{
for(int i = 0; i<numObjects; i++) {
if (images[i].texture != defaultTexture) {
delete(images[i].texture);
}
}
}
if (defaultTexture != nullptr) {
delete defaultTexture;
}
}