diff options
| author | Edward Welbourne <edward.welbourne@qt.io> | 2024-04-08 18:28:39 +0200 |
|---|---|---|
| committer | Edward Welbourne <edward.welbourne@qt.io> | 2024-07-15 20:06:38 +0200 |
| commit | 7551482205794442e11b2b7fd1bf48694a5d3ed6 (patch) | |
| tree | 9f1df4078b99b8e32a21bcce76fe8aa4630caaaf /src/corelib/io/qresource.cpp | |
| parent | 3ab18f40216fd55e57d8a8128ea1fae7612a45a3 (diff) | |
QAFileEngine: let Private take charge of setting its own q_ptr
The QAFE was always setting the q_ptr of the Private just after it was
constructed, but it wasn't immediately obvious the QAFE(Private &)
constructor wasn't stealing its d_ptr of some other QAFE by
overwriting the q_ptr. Passing the file engine's this to the Private's
constructor makes it all unambiguous and incidentally makes it
possible to make clear that q_ptr is in fact const. Fixes a static
analyzer's grumble about Private's constructor not setting q_ptr.
Task-number: QTBUG-122619
Change-Id: Id532bbe628651ad691b7c4b058e01c5cc2e6e241
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Diffstat (limited to 'src/corelib/io/qresource.cpp')
| -rw-r--r-- | src/corelib/io/qresource.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index 83df4e1aec1..bd208896861 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -1397,6 +1397,9 @@ private: // minimum size for which we'll try to re-open ourselves in mapUncompressed() static constexpr qsizetype RemapCompressedThreshold = 16384; protected: + QResourceFileEnginePrivate(QAbstractFileEngine *q) : + QAbstractFileEnginePrivate(q) {} + ~QResourceFileEnginePrivate() { if (mustUnmap) @@ -1410,7 +1413,7 @@ bool QResourceFileEngine::caseSensitive() const } QResourceFileEngine::QResourceFileEngine(const QString &file) : - QAbstractFileEngine(*new QResourceFileEnginePrivate) + QAbstractFileEngine(*new QResourceFileEnginePrivate(this)) { Q_D(QResourceFileEngine); d->resource.setFileName(file); |
