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
qfactorycacheregistration.cpp
Go to the documentation of this file.
1
// Copyright (C) 2022 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
include
"qfactorycacheregistration_p.h"
6
7
#
include
<
QtCore
/
QMutex
>
8
9
QT_BEGIN_NAMESPACE
10
11
#
ifdef
QT_USE_FACTORY_CACHE_REGISTRATION
12
13
static
QBasicMutex
registrationMutex
;
14
static
detail
::
QWinRTFactoryCacheRegistration
*
firstElement
;
15
16
detail
::
QWinRTFactoryCacheRegistration
::
QWinRTFactoryCacheRegistration
(
17
QFunctionPointer
clearFunction
)
18
:
m_clearFunction
(
clearFunction
)
19
{
20
QMutexLocker
lock
(&
registrationMutex
);
21
22
// forward pointers
23
m_next
=
std
::
exchange
(
firstElement
,
this
);
24
25
// backward pointers
26
m_prevNext
= &
firstElement
;
27
if
(
m_next
)
28
m_next
->
m_prevNext
= &
m_next
;
29
}
30
31
detail
::
QWinRTFactoryCacheRegistration
::~
QWinRTFactoryCacheRegistration
()
32
{
33
QMutexLocker
lock
(&
registrationMutex
);
34
35
*
m_prevNext
=
m_next
;
36
37
if
(
m_next
)
38
m_next
->
m_prevNext
=
m_prevNext
;
39
}
40
41
void
detail
::
QWinRTFactoryCacheRegistration
::
clearAllCaches
()
42
{
43
QMutexLocker
lock
(&
registrationMutex
);
44
45
detail
::
QWinRTFactoryCacheRegistration
*
element
;
46
47
for
(
element
=
firstElement
;
element
!=
nullptr
;
element
=
element
->
m_next
) {
48
element
->
m_clearFunction
();
49
}
50
}
51
52
#
endif
53
54
QT_END_NAMESPACE
QSqlRelationalDelegate
\inmodule QtSql
qtbase
src
corelib
platform
windows
qfactorycacheregistration.cpp
Generated on
for Qt by
1.16.1