summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi
diff options
context:
space:
mode:
authorDavid Faure <david.faure@kdab.com>2022-03-13 15:21:19 +0100
committerDavid Faure <david.faure@kdab.com>2022-03-15 21:08:21 +0100
commitfd4672d02023d8c38d8a80da300e135e98b90164 (patch)
tree18d5a5fd5e1f306a106b67b1341ac7aadf1b2f7b /src/gui/rhi
parentd8d202a3baf0035fc9b54d2e9d87efdecf7f0793 (diff)
QShader: fix memory leak in detach()
qAtomicDetach() does d = new T(*d); which calls the copy constructor. Since there was no copy constructor declared for QShaderPrivate, the compiler generated one which copied the refcount over, instead of setting it to 1 in the detached instance. As a result, the destructor didn't delete the QShaderPrivate. Nothing was calling this constructor that takes a pointer, so clearly this was a typo for a copy constructor. Detected in an ASAN build, the qsb tool exited in error. Pick-to: 6.3 6.2 5.15 Change-Id: Idbe659b52d2600ac7c11b09142a6aa5b25310df9 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/rhi')
-rw-r--r--src/gui/rhi/qshader_p_p.h14
-rw-r--r--src/gui/rhi/qshaderdescription_p_p.h22
2 files changed, 18 insertions, 18 deletions
diff --git a/src/gui/rhi/qshader_p_p.h b/src/gui/rhi/qshader_p_p.h
index 51c3e29d45..02215084b1 100644
--- a/src/gui/rhi/qshader_p_p.h
+++ b/src/gui/rhi/qshader_p_p.h
@@ -72,14 +72,14 @@ struct Q_GUI_EXPORT QShaderPrivate
{
}
- QShaderPrivate(const QShaderPrivate *other)
+ QShaderPrivate(const QShaderPrivate &other)
: ref(1),
- qsbVersion(other->qsbVersion),
- stage(other->stage),
- desc(other->desc),
- shaders(other->shaders),
- bindings(other->bindings),
- combinedImageMap(other->combinedImageMap)
+ qsbVersion(other.qsbVersion),
+ stage(other.stage),
+ desc(other.desc),
+ shaders(other.shaders),
+ bindings(other.bindings),
+ combinedImageMap(other.combinedImageMap)
{
}
diff --git a/src/gui/rhi/qshaderdescription_p_p.h b/src/gui/rhi/qshaderdescription_p_p.h
index 0ef7869d7b..c6c80fc9e6 100644
--- a/src/gui/rhi/qshaderdescription_p_p.h
+++ b/src/gui/rhi/qshaderdescription_p_p.h
@@ -66,18 +66,18 @@ struct Q_GUI_EXPORT QShaderDescriptionPrivate
localSize[0] = localSize[1] = localSize[2] = 0;
}
- QShaderDescriptionPrivate(const QShaderDescriptionPrivate *other)
+ QShaderDescriptionPrivate(const QShaderDescriptionPrivate &other)
: ref(1),
- inVars(other->inVars),
- outVars(other->outVars),
- uniformBlocks(other->uniformBlocks),
- pushConstantBlocks(other->pushConstantBlocks),
- storageBlocks(other->storageBlocks),
- combinedImageSamplers(other->combinedImageSamplers),
- separateImages(other->separateImages),
- separateSamplers(other->separateSamplers),
- storageImages(other->storageImages),
- localSize(other->localSize)
+ inVars(other.inVars),
+ outVars(other.outVars),
+ uniformBlocks(other.uniformBlocks),
+ pushConstantBlocks(other.pushConstantBlocks),
+ storageBlocks(other.storageBlocks),
+ combinedImageSamplers(other.combinedImageSamplers),
+ separateImages(other.separateImages),
+ separateSamplers(other.separateSamplers),
+ storageImages(other.storageImages),
+ localSize(other.localSize)
{
}