--- ../Rack/src/context.cpp 2023-05-20 17:03:33.006081772 +0200 +++ context.cpp 2023-05-20 18:08:56.497736615 +0200 @@ -1,14 +1,44 @@ +/* + * DISTRHO Cardinal Plugin + * Copyright (C) 2021-2023 Filipe Coelho + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * For a full copy of the GNU General Public License see the LICENSE file. + */ + +/** + * This file is an edited version of VCVRack's context.cpp + * Copyright (C) 2016-2023 VCV. + * + * This program is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + */ + #include #include #include #include #include #include -#include +#ifdef NDEBUG +# undef DEBUG +#endif -namespace rack { +#include "DistrhoUtils.hpp" +namespace rack { Context::~Context() { // Deleting NULL is safe in C++. @@ -38,17 +68,13 @@ INFO("Deleting engine"); delete engine; engine = NULL; - - INFO("Deleting MIDI loopback"); - delete midiLoopbackContext; - midiLoopbackContext = NULL; } static thread_local Context* threadContext = NULL; Context* contextGet() { - assert(threadContext); + DISTRHO_SAFE_ASSERT(threadContext != nullptr); return threadContext; }