mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Initialize pointer and use less restrictive condition in destructor
This commit is contained in:
parent
5db5fb7e0c
commit
98a6ef5698
@ -191,7 +191,7 @@ struct Preset pressetYACReaderFlowDownConfig = {
|
|||||||
};
|
};
|
||||||
/*Constructor*/
|
/*Constructor*/
|
||||||
YACReaderFlowGL::YACReaderFlowGL(QWidget *parent, struct Preset p)
|
YACReaderFlowGL::YACReaderFlowGL(QWidget *parent, struct Preset p)
|
||||||
: QOpenGLWidget(/*QOpenGLWidget migration QGLFormat(QGL::SampleBuffers),*/ parent), numObjects(0), lazyPopulateObjects(-1), hasBeenInitialized(false), bUseVSync(false), flowRightToLeft(false)
|
: QOpenGLWidget(/*QOpenGLWidget migration QGLFormat(QGL::SampleBuffers),*/ parent), numObjects(0), lazyPopulateObjects(-1), defaultTexture(nullptr), hasBeenInitialized(false), bUseVSync(false), flowRightToLeft(false)
|
||||||
{
|
{
|
||||||
updateCount = 0;
|
updateCount = 0;
|
||||||
config = p;
|
config = p;
|
||||||
@ -1270,22 +1270,20 @@ YACReaderPageFlowGL::~YACReaderPageFlowGL()
|
|||||||
|
|
||||||
makeCurrent();
|
makeCurrent();
|
||||||
|
|
||||||
if (this->context() != nullptr && this->context()->isValid()) {
|
for (auto image : images) {
|
||||||
for (auto image : images) {
|
if (image.texture != defaultTexture) {
|
||||||
if (image.texture != defaultTexture) {
|
if (image.texture->isCreated()) {
|
||||||
if (image.texture->isCreated()) {
|
image.texture->destroy();
|
||||||
image.texture->destroy();
|
|
||||||
}
|
|
||||||
delete image.texture;
|
|
||||||
}
|
}
|
||||||
|
delete image.texture;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (defaultTexture != nullptr) {
|
if (defaultTexture != nullptr) {
|
||||||
if (defaultTexture->isCreated()) {
|
if (defaultTexture->isCreated()) {
|
||||||
defaultTexture->destroy();
|
defaultTexture->destroy();
|
||||||
}
|
|
||||||
delete defaultTexture;
|
|
||||||
}
|
}
|
||||||
|
delete defaultTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
doneCurrent();
|
doneCurrent();
|
||||||
|
Loading…
Reference in New Issue
Block a user