Skip to content

Commit

Permalink
Merge pull request #545 from coin3d/issue544
Browse files Browse the repository at this point in the history
Fix invalid access when removing callback.
  • Loading branch information
VolkerEnderlein authored Jan 16, 2025
2 parents 67a4b06 + fb3ec19 commit 905021d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/lists/SoCallbackList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ SoCallbackList::removeCallback(SoCallbackListCB * f, void * userdata)
// of course whether it should be allowed to have the same callback
// entry in the list twice...) 20050723 kyrah.
while (idx != -1) {
if ((this->funclist[idx] == (void*)f) && (this->datalist[idx] == userdata)) break;
if ((this->funclist[idx] == (void*)f) && (this->datalist[idx] == userdata)) {
this->funclist.remove(idx);
this->datalist.remove(idx);
break;
}
idx--;
}

Expand All @@ -109,9 +113,6 @@ SoCallbackList::removeCallback(SoCallbackListCB * f, void * userdata)
return;
}
#endif // COIN_DEBUG

this->funclist.remove(idx);
this->datalist.remove(idx);
}

/*!
Expand Down

0 comments on commit 905021d

Please sign in to comment.