Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[qtcontacts-sqlite] Avoid QVariant comparison during destruction. Con…
…tributes to JB#51416

In some circumstances, QVariant comparison can crash within
QVariant::cmp() / QMetaType::equals().  So, avoid QVariant comparison
and instead use direct pointer comparison during engine dtor.
  • Loading branch information
Chris Adams committed Oct 6, 2020
1 parent 73ae220 commit 829d3c7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/engine/contactsengine.cpp
Expand Up @@ -1343,7 +1343,8 @@ ContactsEngine::~ContactsEngine()
QCoreApplication *app = QCoreApplication::instance();
QList<QVariant> engines = app->property(CONTACT_MANAGER_ENGINE_PROP).toList();
for (int i = 0; i < engines.size(); ++i) {
if (engines[i] == QVariant::fromValue(this)) {
QContactManagerEngine *engine = static_cast<QContactManagerEngine*>(engines[i].value<QObject*>());
if (engine == this) {
engines.removeAt(i);
break;
}
Expand Down

0 comments on commit 829d3c7

Please sign in to comment.