more safety for PIObject::Connection::disconnect()
This commit is contained in:
@@ -660,7 +660,11 @@ PIObject::Connection::Connection() {
|
||||
|
||||
bool PIObject::Connection::disconnect() {
|
||||
if (!isValid() || !src_o) return false;
|
||||
if (!src_o->isPIObject()) return false;
|
||||
bool ndm = dest_o && (src_o != dest_o), ret = false, found = false;
|
||||
if (dest_o) {
|
||||
if (!dest_o->isPIObject()) ndm = false;
|
||||
}
|
||||
PIMutexLocker _ml(src_o->mutex_connect);
|
||||
if (ndm) dest_o->mutex_connect.lock();
|
||||
for (int i = 0; i < src_o->connections.size_s(); ++i) {
|
||||
@@ -680,8 +684,10 @@ bool PIObject::Connection::disconnect() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (dest_o)
|
||||
dest_o->updateConnectors();
|
||||
if (dest_o) {
|
||||
if (dest_o->isPIObject())
|
||||
dest_o->updateConnectors();
|
||||
}
|
||||
if (ndm) dest_o->mutex_connect.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user