Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwltextureorphanage.cpp
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
6
7#include <QOpenGLContext>
8#include <QOpenGLTexture>
9#include <QDebug>
10#include <QtTypeTraits>
11#include <QMutexLocker>
12
14
15Q_LOGGING_CATEGORY(qLcWTO, "qt.waylandcompositor.orphanage")
16
17Q_GLOBAL_STATIC(QtWayland::QWaylandTextureOrphanage, inst)
18
19namespace QtWayland {
20
22{
25 qCWarning(qLcWTO) << Q_FUNC_INFO << "m_orphanedTextures container isn't empty! content:"
27 }
28}
29
34
36{
37 qCDebug(qLcWTO) << Q_FUNC_INFO << "got a texture (" << (void *)tex
38 << ") ready to be deleted! It's ctx:" << ctx;
39
40 {
43 }
44
46 [this, ctx]() { this->onContextAboutToBeDestroyed(ctx); },
48}
49
51{
53
54 if (cCtx == nullptr) {
55 qCWarning(qLcWTO) << Q_FUNC_INFO << "cannot delete textures without current OpenGL context";
56 return;
57 }
58
59 {
61
62 const auto contexts = m_orphanedTextures.keys();
65
66 qCDebug(qLcWTO) << Q_FUNC_INFO << "currentContext (" << cCtx
67 << ") and ctx of orphane(s) (" << aCtx
68 << ") are shared! => deleteTexturesByContext";
69
71 }
72 }
73 }
74}
75
77{
78 Q_ASSERT(ctx != nullptr);
79
80 qCDebug(qLcWTO) << Q_FUNC_INFO << " ctx (" << ctx
81 << ") fired aboutToBeDestroyed => deleteTexturesByContext(ctx)";
82
83 {
86 }
87}
88
90{
91 // NOTE: We are (by class-internal design) locked (m_containerLock)
92 // when we enter this function!
93 // If not (e.g.: someone changes something in/around this class),
94 // then in a debug-build we will fail below:
96
99
101 delete tex;
102 qCDebug(qLcWTO) << Q_FUNC_INFO << " texture (" << (void *)tex << ") got deleted";
103 }
104}
105
106} // namespace QtWayland
107
108QT_END_NAMESPACE
109
110#include "moc_qwltextureorphanage_p.cpp"
Combined button and popup list for selecting options.