summaryrefslogtreecommitdiff
path: root/libs/surfaces
diff options
context:
space:
mode:
authorNikolaus Gullotta <nik@harrisonconsoles.com>2020-03-09 13:02:38 -0500
committerNikolaus Gullotta <nik@harrisonconsoles.com>2020-03-09 13:02:38 -0500
commit810b2fb78d89b24de7f35ca8429e384ab5125a22 (patch)
tree6dcd1bd99dfd4074aeee458973ba1603f4b9d3c3 /libs/surfaces
parent379115a20e2c57460324f0ba6a493bf76c3af908 (diff)
Prevent double free of global observers
We accomplish this by explicitly setting the global_obs to NULL after free'ing it. The crash that led to this fix can be replicated as such $ sendosc localhost 3819 /set_surface i 8 i 159 i 8 $ sendosc localhost 3819 /set_surface i 0 i 0 i 0 $ sendosc localhost 3819 /set_surface i 0 i 0 i 0 In this example the observer is created, then free'd, and then free'd *again* because the new observer was never made (sur->feedback[x] checks fail)
Diffstat (limited to 'libs/surfaces')
-rw-r--r--libs/surfaces/osc/osc.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc
index be4e45e409..3ca40c4991 100644
--- a/libs/surfaces/osc/osc.cc
+++ b/libs/surfaces/osc/osc.cc
@@ -2243,6 +2243,7 @@ OSC::global_feedback (OSCSurface* sur)
OSCGlobalObserver* o = sur->global_obs;
if (o) {
delete o;
+ sur->global_obs = NULL;
}
if (sur->feedback[4] || sur->feedback[3] || sur->feedback[5] || sur->feedback[6]) {