Use data types that will only destroy it when necessary.
Details
Details
Diff Detail
Diff Detail
- Repository
- R273 KGuiAddons
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Comment Actions
I don't understand the bug being fixed.
We have:
Q_DISABLE_COPY(KModifierKeyInfo)
So why does KModifierKeyInfo::Private need to be shared?
Comment Actions
So why does KModifierKeyInfo::Private need to be shared?
It needs to be refcounted. In 0fe2990dbad992a4925a7b7bee09b1cdfbe5a7a7 a plugin infrastructure was introduced. Unbeknownst to us the instances are shared internally by Qt.
KModifierKeyInfoProvider* createProvider() { QPluginLoader loader(QStringLiteral("kf5/kguiaddons/kmodifierkey/kmodifierkey_")+qGuiApp->platformName()); auto instance = dynamic_cast<KModifierKeyInfoProvider*>(loader.instance()); if (instance) return instance; ... KModifierKeyInfo::KModifierKeyInfo(QObject *parent) : QObject(parent), p(createProvider())
The instance returned is the same every time despite the QPluginLoader being on the stack.
Now the destructor of KModifierKeyInfo cleans up p and if you have two instances of KModifierKeyInfo, which Kile does for instance, it crashes on double delete.
Comment Actions
Yes it is, we're just modifying the size of a private class.
Also this was never released yet.