Skip to content

Commit

Permalink
OPC DA: Remove items and group only if available
Browse files Browse the repository at this point in the history
It is possible to create an FB without a read group or without a
write group.
  • Loading branch information
kumajaya committed Apr 2, 2024
1 parent 62e423b commit a8ecfc7
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/com/opc/opcconnectionimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,15 @@ void COpcConnectionImpl::removeGroup(const char* paGroupName){
}
for(auto group = mOpcGroupSettingsList.begin(); group != mOpcGroupSettingsList.end();){
if(nullptr == paGroupName || 0 == strcmp((*group)->mGroupName, paGroupName)){
removeItems(WS2S((*group)->mOpcGroupRead->getName()).c_str());
removeItems(WS2S((*group)->mOpcGroupWrite->getName()).c_str());
delete (*group)->mOpcGroupRead;
delete (*group)->mOpcGroupWrite;
if (nullptr != (*group)->mOpcGroupRead) {
(*group)->mOpcGroupRead->disableAsync();
removeItems(WS2S((*group)->mOpcGroupRead->getName()).c_str());
delete (*group)->mOpcGroupRead;
}
if (nullptr != (*group)->mOpcGroupWrite) {
removeItems(WS2S((*group)->mOpcGroupWrite->getName()).c_str());
delete (*group)->mOpcGroupWrite;
}
group = mOpcGroupSettingsList.erase(group);
if(nullptr == paGroupName){
continue;
Expand Down

0 comments on commit a8ecfc7

Please sign in to comment.