Skip to content

Commit 0a60a49

Browse files
committed
fixes sync access to patch objects map, avoid access while reconfiguring map
1 parent 0a5ab6e commit 0a60a49

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/ofxVisualProgramming.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ ofxVisualProgramming::ofxVisualProgramming(){
6666
lastAddedObjectID = -1;
6767
bLoadingNewObject = false;
6868
bLoadingNewPatch = false;
69+
bPopulatingObjectsMap = false;
6970
clearingObjectsMap = false;
7071

7172
livePatchingObiID = -1;
@@ -225,7 +226,9 @@ void ofxVisualProgramming::update(){
225226
}
226227

227228
// Clear map from deleted objects
228-
clearObjectsMap();
229+
if(!bPopulatingObjectsMap){
230+
clearObjectsMap();
231+
}
229232

230233
// update patch objects
231234
if(!bLoadingNewPatch && !patchObjects.empty()){
@@ -1568,6 +1571,8 @@ void ofxVisualProgramming::loadPatch(string patchFile){
15681571
XML.popTag();
15691572
}
15701573

1574+
bPopulatingObjectsMap = true;
1575+
15711576
int totalObjects = XML.getNumTags("object");
15721577

15731578
if(totalObjects > 0){
@@ -1645,6 +1650,8 @@ void ofxVisualProgramming::loadPatch(string patchFile){
16451650
}
16461651
}
16471652

1653+
bPopulatingObjectsMap = false;
1654+
16481655
activateDSP();
16491656

16501657
}

src/ofxVisualProgramming.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ class ofxVisualProgramming : public pdsp::Wrapper {
153153
int lastAddedObjectID;
154154
bool bLoadingNewObject;
155155
bool bLoadingNewPatch;
156+
bool bPopulatingObjectsMap;
156157
bool clearingObjectsMap;
157158

158159
// LOAD/SAVE

0 commit comments

Comments
 (0)