fixed possible crash in GxsIdDetails

This commit is contained in:
Cyril Soler 2016-04-12 10:06:01 -04:00
parent d5ed84ec9d
commit cf746f160c

View File

@ -127,8 +127,8 @@ void GxsIdDetails::connectObject_locked(QObject *object, bool doConnect)
/* Search Object in pending list */ /* Search Object in pending list */
if(mPendingData.find(object) != mPendingData.end()) if(mPendingData.find(object) == mPendingData.end()) // force disconnect when not in the list
return ; doConnect = false ;
if (doConnect) { if (doConnect) {
connect(object, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*))); connect(object, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(QObject*)));
@ -169,10 +169,10 @@ void GxsIdDetails::timerEvent(QTimerEvent *event)
pendingData.mCallback(GXS_ID_DETAILS_TYPE_DONE, details, pendingData.mObject, pendingData.mData); pendingData.mCallback(GXS_ID_DETAILS_TYPE_DONE, details, pendingData.mObject, pendingData.mData);
QObject *object = pendingData.mObject; QObject *object = pendingData.mObject;
mPendingDataIterator = mPendingData.erase(mPendingDataIterator);
connectObject_locked(object, false); connectObject_locked(object, false);
mPendingDataIterator = mPendingData.erase(mPendingDataIterator);
continue; continue;
} }
@ -182,10 +182,10 @@ void GxsIdDetails::timerEvent(QTimerEvent *event)
pendingData.mCallback(GXS_ID_DETAILS_TYPE_FAILED, details, pendingData.mObject, pendingData.mData); pendingData.mCallback(GXS_ID_DETAILS_TYPE_FAILED, details, pendingData.mObject, pendingData.mData);
QObject *object = pendingData.mObject; QObject *object = pendingData.mObject;
mPendingDataIterator = mPendingData.erase(mPendingDataIterator);
connectObject_locked(object, false); connectObject_locked(object, false);
mPendingDataIterator = mPendingData.erase(mPendingDataIterator);
continue; continue;
} }