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/qfsfileengine.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/qfsfileengine.cpp')
| -rw-r--r-- | src/corelib/io/qfsfileengine.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 2f9087bf6a3..6610b6ecd66 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -76,7 +76,8 @@ static_assert(sizeof(SignedIOType) == sizeof(UnsignedIOType), */ //**************** QFSFileEnginePrivate -QFSFileEnginePrivate::QFSFileEnginePrivate() : QAbstractFileEnginePrivate() +QFSFileEnginePrivate::QFSFileEnginePrivate(QAbstractFileEngine *q) + : QAbstractFileEnginePrivate(q) { init(); } @@ -108,7 +109,7 @@ void QFSFileEnginePrivate::init() Constructs a QFSFileEngine for the file name \a file. */ QFSFileEngine::QFSFileEngine(const QString &file) - : QAbstractFileEngine(*new QFSFileEnginePrivate) + : QAbstractFileEngine(*new QFSFileEnginePrivate(this)) { Q_D(QFSFileEngine); d->fileEntry = QFileSystemEntry(file); @@ -117,7 +118,7 @@ QFSFileEngine::QFSFileEngine(const QString &file) /*! Constructs a QFSFileEngine. */ -QFSFileEngine::QFSFileEngine() : QAbstractFileEngine(*new QFSFileEnginePrivate) +QFSFileEngine::QFSFileEngine() : QAbstractFileEngine(*new QFSFileEnginePrivate(this)) { } |
