QOpenGLContext: de-inline virtual dtors of private classes

... pinning the vtables to a single TU instead of duplicating them for
every user.

Pick-to: 6.4
Task-number: QTBUG-45582
Change-Id: I728a5c47edaafe7ef4fdca1db8d0247ed4be9713
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Marc Mutz 2022-07-12 19:43:47 +02:00
parent b36d7076e4
commit 12f8b583cf
2 changed files with 22 additions and 8 deletions

View File

@ -360,6 +360,14 @@ bool QOpenGLContext::create()
return isValid();
}
QOpenGLContextPrivate::~QOpenGLContextPrivate()
{
//do not delete the QOpenGLContext handle here as it is deleted in
//QWidgetPrivate::deleteTLSysExtra()
delete versionFunctions;
}
void QOpenGLContextPrivate::adopt(QPlatformOpenGLContext *context)
{
Q_Q(QOpenGLContext);
@ -995,6 +1003,9 @@ QOpenGLContextGroup *QOpenGLContextGroup::currentContextGroup()
return current ? current->shareGroup() : nullptr;
}
QOpenGLContextGroupPrivate::~QOpenGLContextGroupPrivate()
= default;
void QOpenGLContextGroupPrivate::addContext(QOpenGLContext *ctx)
{
const auto locker = qt_scoped_lock(m_mutex);
@ -1136,6 +1147,10 @@ void QOpenGLSharedResource::free()
\inmodule QtGui
*/
QOpenGLSharedResourceGuard::~QOpenGLSharedResourceGuard()
= default;
void QOpenGLSharedResourceGuard::freeResource(QOpenGLContext *context)
{
if (m_id) {
@ -1235,6 +1250,9 @@ void QOpenGLMultiGroupSharedResource::cleanup(QOpenGLContextGroup *group, QOpenG
m_groups.removeOne(group);
}
QOpenGLContextVersionFunctionHelper::~QOpenGLContextVersionFunctionHelper()
= default;
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug debug, const QOpenGLContext *ctx)
{

View File

@ -74,6 +74,7 @@ public:
, m_func(func)
{
}
~QOpenGLSharedResourceGuard() override;
GLuint id() const { return m_id; }
@ -99,6 +100,7 @@ public:
, m_refs(0)
{
}
~QOpenGLContextGroupPrivate() override;
void addContext(QOpenGLContext *ctx);
void removeContext(QOpenGLContext *ctx);
@ -160,7 +162,7 @@ class QOpenGLVertexArrayObjectHelper;
class Q_GUI_EXPORT QOpenGLContextVersionFunctionHelper
{
public:
virtual ~QOpenGLContextVersionFunctionHelper() {}
virtual ~QOpenGLContextVersionFunctionHelper();
};
class Q_GUI_EXPORT QOpenGLContextPrivate : public QObjectPrivate
@ -190,13 +192,7 @@ public:
requestedFormat = QSurfaceFormat::defaultFormat();
}
~QOpenGLContextPrivate()
{
//do not delete the QOpenGLContext handle here as it is deleted in
//QWidgetPrivate::deleteTLSysExtra()
delete versionFunctions;
}
~QOpenGLContextPrivate() override;
void adopt(QPlatformOpenGLContext *);