Fix the crash when closing a document
Closes #14189. This commit partially reverts 626e6a1a70aeca40a3773f617a2cef0093991a75 and 95748f8f5eac02007b6f3def89f65fc2181aba09.
This commit is contained in:
@@ -164,9 +164,8 @@ public:
|
||||
#endif
|
||||
setFormat(surfaceFormat);
|
||||
}
|
||||
~CustomGLWidget() override
|
||||
{
|
||||
}
|
||||
~CustomGLWidget() override = default;
|
||||
|
||||
void initializeGL() override
|
||||
{
|
||||
QOpenGLContext *context = QOpenGLContext::currentContext();
|
||||
@@ -179,10 +178,7 @@ public:
|
||||
logger->startLogging(QOpenGLDebugLogger::SynchronousLogging);
|
||||
}
|
||||
#endif
|
||||
if (context) {
|
||||
connect(context, &QOpenGLContext::aboutToBeDestroyed,
|
||||
this, &CustomGLWidget::aboutToDestroyGLContext, Qt::DirectConnection);
|
||||
}
|
||||
|
||||
connect(this, &CustomGLWidget::resized, this, &CustomGLWidget::slotResized);
|
||||
}
|
||||
// paintGL() is invoked when e.g. using the method grabFramebuffer of this class
|
||||
@@ -200,17 +196,7 @@ public:
|
||||
qw->redraw();
|
||||
}
|
||||
}
|
||||
void aboutToDestroyGLContext()
|
||||
{
|
||||
// With Qt 5.9 a signal is emitted while the QuarterWidget is being destroyed.
|
||||
// At this state its type is a QWidget, not a QuarterWidget any more.
|
||||
QuarterWidget* qw = qobject_cast<QuarterWidget*>(parent());
|
||||
if (!qw)
|
||||
return;
|
||||
QMetaObject::invokeMethod(parent(), "aboutToDestroyGLContext",
|
||||
Qt::DirectConnection,
|
||||
QGenericReturnArgument());
|
||||
}
|
||||
|
||||
bool event(QEvent *e) override
|
||||
{
|
||||
// If a debug logger is activated then Qt's default implementation
|
||||
@@ -334,11 +320,6 @@ QuarterWidget::replaceViewport()
|
||||
viewport()->setAutoFillBackground(false);
|
||||
}
|
||||
|
||||
void
|
||||
QuarterWidget::aboutToDestroyGLContext()
|
||||
{
|
||||
}
|
||||
|
||||
/*! destructor */
|
||||
QuarterWidget::~QuarterWidget()
|
||||
{
|
||||
|
||||
@@ -193,7 +193,6 @@ Q_SIGNALS:
|
||||
|
||||
private Q_SLOTS:
|
||||
void replaceViewport();
|
||||
virtual void aboutToDestroyGLContext();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent*) override;
|
||||
|
||||
@@ -490,7 +490,7 @@ private:
|
||||
static void drawArrow();
|
||||
static void drawSingleBackground(const QColor&);
|
||||
void setCursorRepresentation(int mode);
|
||||
void aboutToDestroyGLContext() override;
|
||||
void aboutToDestroyGLContext();
|
||||
void createStandardCursors(double);
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user