QDbus: Avoid memory leak in registerComplexDBusType
QMetaType does not own the interface from which it is constructed. Consequently, we end up with a memory leak. This is not a huge issue, given that the map of meta-types is static, and the application is about to be close when can discard it anyway, but it causes avoidable sanitizer warnings, which are annoying when debugging more severe memory leaks. Pick-to: 6.6 6.5 Change-Id: Ifee3f4e19835536f4a6cfa4f6866ab621581ad4f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
c41733b06b
commit
4c1df115ec
@ -116,8 +116,11 @@ static int registerComplexDBusType(const QByteArray &typeName)
|
||||
{
|
||||
~Hash()
|
||||
{
|
||||
for (QMetaType entry : *this)
|
||||
for (QMetaType entry : std::as_const(*this)) {
|
||||
auto iface = static_cast<const QDBusRawTypeHandler *>(entry.iface());
|
||||
QMetaType::unregisterMetaType(std::move(entry));
|
||||
delete iface;
|
||||
}
|
||||
}
|
||||
} hash;
|
||||
QMutexLocker lock(&mutex);
|
||||
|
Loading…
x
Reference in New Issue
Block a user