Skip to content

Commit bfbedaf

Browse files
authored
[critical bug fix] Osc scope2 (#7981)
#changelog #addon
1 parent 184bb11 commit bfbedaf

3 files changed

Lines changed: 5 additions & 12 deletions

File tree

addons/ofxOsc/libs/oscpack/src/ip/posix/UdpSocket.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#include <cstring> // for memset
5757
#include <stdexcept>
5858
#include <vector>
59+
#include <atomic>
5960

6061
#include "ip/PacketListener.h"
6162
#include "ip/TimerListener.h"

addons/ofxOsc/src/ofxOscReceiver.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,11 @@ bool ofxOscReceiver::start() {
9696
}
9797
});
9898

99-
// detach thread so we don't have to wait on it before creating a new socket
100-
// or on destruction, the custom deleter for the socket unique_ptr already
101-
// does the right thing
102-
103-
#ifndef OSC_NO_DETACH
104-
listenThread.detach();
105-
#endif
10699
return true;
107100
}
108101

109102
//--------------------------------------------------------------
110103
void ofxOscReceiver::stop() {
111-
#ifdef OSC_NO_DETACH
112104
if (listenSocket) {
113105
listenSocket->AsynchronousBreak();
114106
} else {
@@ -120,7 +112,6 @@ void ofxOscReceiver::stop() {
120112
} else {
121113
listenThread.join();
122114
}
123-
#endif
124115
listenSocket.reset();
125116
}
126117

apps/devApps/StressofxOscReceiver/src/ofApp.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "ofApp.h"
22

3-
#define USE_EXPLICIT_FUNCTION 1
3+
//#define USE_EXPLICIT_FUNCTION 1
44

55
#define INSTANTLY_OUT_OF_SCOPE 1
66

@@ -11,8 +11,9 @@ void ofApp::setup(){
1111
ofSetVerticalSync(false);
1212

1313
#ifdef INSTANTLY_OUT_OF_SCOPE
14-
ofLogNotice("will hang");
15-
ofxOscReceiver r;
14+
ofLogNotice("will hang if thread problem");
15+
std::unique_ptr<ofxOscReceiver> r = std::make_unique<ofxOscReceiver>();
16+
r = std::make_unique<ofxOscReceiver>();
1617
#endif
1718
ofLogNotice("ready to roll");
1819

0 commit comments

Comments
 (0)