From b141015f81d5eca118aa283a6e96d5b76937fde5 Mon Sep 17 00:00:00 2001 From: AntonioBL Date: Fri, 22 Mar 2019 17:53:39 +0100 Subject: [PATCH] fix #281867 crash on Mac when stopping porttime --- thirdparty/portmidi/porttime/ptmacosx_cf.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/thirdparty/portmidi/porttime/ptmacosx_cf.c b/thirdparty/portmidi/porttime/ptmacosx_cf.c index a174c864e0..fb173b6329 100644 --- a/thirdparty/portmidi/porttime/ptmacosx_cf.c +++ b/thirdparty/portmidi/porttime/ptmacosx_cf.c @@ -17,7 +17,7 @@ static int time_started_flag = FALSE; static CFAbsoluteTime startTime = 0.0; -static CFRunLoopRef timerRunLoop; +static CFRunLoopRef timerRunLoop = 0; typedef struct { int resolution; @@ -115,7 +115,10 @@ PtError Pt_Stop() { printf("Pt_Stop called\n"); - CFRunLoopStop(timerRunLoop); + if (timerRunLoop) { + CFRunLoopStop(timerRunLoop); + timerRunLoop = 0; + } time_started_flag = FALSE; return ptNoError; }