Cleanup related fixes
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
10330964ea
commit
3046133883
5 changed files with 111 additions and 3 deletions
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
|
|
@ -745,7 +745,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
pushd deps/PawPaw; source local.env win32; popd
|
pushd deps/PawPaw; source local.env win32; popd
|
||||||
make features
|
make features
|
||||||
xvfb-run make CIBUILD=true NOOPT=true WITH_LTO=true -j $(nproc)
|
make CIBUILD=true NOOPT=true WITH_LTO=true -j $(nproc)
|
||||||
- name: Build win64 cross-compiled (carla)
|
- name: Build win64 cross-compiled (carla)
|
||||||
run: |
|
run: |
|
||||||
pushd deps/PawPaw; source local.env win32; popd
|
pushd deps/PawPaw; source local.env win32; popd
|
||||||
|
|
@ -837,7 +837,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
pushd deps/PawPaw; source local.env win64; popd
|
pushd deps/PawPaw; source local.env win64; popd
|
||||||
make features
|
make features
|
||||||
xvfb-run make CIBUILD=true NOOPT=true WITH_LTO=true -j $(nproc)
|
make CIBUILD=true NOOPT=true WITH_LTO=true -j $(nproc)
|
||||||
- name: Build win64 cross-compiled (carla)
|
- name: Build win64 cross-compiled (carla)
|
||||||
run: |
|
run: |
|
||||||
pushd deps/PawPaw; source local.env win64; popd
|
pushd deps/PawPaw; source local.env win64; popd
|
||||||
|
|
|
||||||
2
dpf
2
dpf
|
|
@ -1 +1 @@
|
||||||
Subproject commit 144ec075cc4feed77bc8ca08d0d16901f04a3806
|
Subproject commit a4eed81b7311c32284883f265d7634c5354f17d7
|
||||||
|
|
@ -52,6 +52,7 @@
|
||||||
static const constexpr uint kCardinalStateBaseCount = 3; // patch, screenshot, comment
|
static const constexpr uint kCardinalStateBaseCount = 3; // patch, screenshot, comment
|
||||||
|
|
||||||
#ifndef HEADLESS
|
#ifndef HEADLESS
|
||||||
|
# include "extra/ScopedValueSetter.hpp"
|
||||||
# include "WindowParameters.hpp"
|
# include "WindowParameters.hpp"
|
||||||
static const constexpr uint kCardinalStateCount = kCardinalStateBaseCount + 2; // moduleInfos, windowSize
|
static const constexpr uint kCardinalStateCount = kCardinalStateBaseCount + 2; // moduleInfos, windowSize
|
||||||
#else
|
#else
|
||||||
|
|
@ -68,6 +69,9 @@ static const constexpr uint kCardinalStateCount = kCardinalStateBaseCount;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace rack {
|
namespace rack {
|
||||||
|
namespace engine {
|
||||||
|
void Engine_setAboutToClose(Engine*);
|
||||||
|
}
|
||||||
namespace plugin {
|
namespace plugin {
|
||||||
void initStaticPlugins();
|
void initStaticPlugins();
|
||||||
void destroyStaticPlugins();
|
void destroyStaticPlugins();
|
||||||
|
|
@ -572,6 +576,12 @@ public:
|
||||||
{
|
{
|
||||||
const ScopedContext sc(this);
|
const ScopedContext sc(this);
|
||||||
context->patch->clear();
|
context->patch->clear();
|
||||||
|
|
||||||
|
// do a little dance to prevent context scene deletion from saving to temp dir
|
||||||
|
#ifndef HEADLESS
|
||||||
|
const ScopedValueSetter<bool> svs(rack::settings::headless, true);
|
||||||
|
#endif
|
||||||
|
Engine_setAboutToClose(context->engine);
|
||||||
delete context;
|
delete context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
90
src/extra/ScopedValueSetter.hpp
Normal file
90
src/extra/ScopedValueSetter.hpp
Normal file
|
|
@ -0,0 +1,90 @@
|
||||||
|
/*
|
||||||
|
* Scope value setter, taken from JUCE v4
|
||||||
|
* Copyright (C) 2013 Raw Material Software Ltd.
|
||||||
|
* Copyright (c) 2016 ROLI Ltd.
|
||||||
|
* Copyright (C) 2013-2020 Filipe Coelho <falktx@falktx.com>
|
||||||
|
*
|
||||||
|
* 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 2 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 doc/GPL.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "DistrhoUtils.hpp"
|
||||||
|
|
||||||
|
START_NAMESPACE_DISTRHO
|
||||||
|
|
||||||
|
//=====================================================================================================================
|
||||||
|
/**
|
||||||
|
Helper class providing an RAII-based mechanism for temporarily setting and
|
||||||
|
then re-setting a value.
|
||||||
|
|
||||||
|
E.g. @code
|
||||||
|
int x = 1;
|
||||||
|
|
||||||
|
{
|
||||||
|
ScopedValueSetter setter (x, 2);
|
||||||
|
|
||||||
|
// x is now 2
|
||||||
|
}
|
||||||
|
|
||||||
|
// x is now 1 again
|
||||||
|
|
||||||
|
{
|
||||||
|
ScopedValueSetter setter (x, 3, 4);
|
||||||
|
|
||||||
|
// x is now 3
|
||||||
|
}
|
||||||
|
|
||||||
|
// x is now 4
|
||||||
|
@endcode
|
||||||
|
*/
|
||||||
|
template <typename ValueType>
|
||||||
|
class ScopedValueSetter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/** Creates a ScopedValueSetter that will immediately change the specified value to the
|
||||||
|
given new value, and will then reset it to its original value when this object is deleted.
|
||||||
|
Must be used only for 'noexcept' compatible types.
|
||||||
|
*/
|
||||||
|
ScopedValueSetter(ValueType& valueToSet, ValueType newValue) noexcept
|
||||||
|
: value(valueToSet),
|
||||||
|
originalValue(valueToSet)
|
||||||
|
{
|
||||||
|
valueToSet = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Creates a ScopedValueSetter that will immediately change the specified value to the
|
||||||
|
given new value, and will then reset it to be valueWhenDeleted when this object is deleted.
|
||||||
|
*/
|
||||||
|
ScopedValueSetter(ValueType& valueToSet, ValueType newValue, ValueType valueWhenDeleted) noexcept
|
||||||
|
: value(valueToSet),
|
||||||
|
originalValue(valueWhenDeleted)
|
||||||
|
{
|
||||||
|
valueToSet = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
~ScopedValueSetter() noexcept
|
||||||
|
{
|
||||||
|
value = originalValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
//=================================================================================================================
|
||||||
|
ValueType& value;
|
||||||
|
const ValueType originalValue;
|
||||||
|
|
||||||
|
DISTRHO_DECLARE_NON_COPYABLE(ScopedValueSetter)
|
||||||
|
DISTRHO_PREVENT_HEAP_ALLOCATION
|
||||||
|
};
|
||||||
|
|
||||||
|
END_NAMESPACE_DISTRHO
|
||||||
|
|
@ -79,6 +79,7 @@ struct Engine::Internal {
|
||||||
int64_t blockFrame = 0;
|
int64_t blockFrame = 0;
|
||||||
double blockTime = 0.0;
|
double blockTime = 0.0;
|
||||||
int blockFrames = 0;
|
int blockFrames = 0;
|
||||||
|
bool aboutToClose = false;
|
||||||
|
|
||||||
#ifndef HEADLESS
|
#ifndef HEADLESS
|
||||||
// Meter
|
// Meter
|
||||||
|
|
@ -776,6 +777,8 @@ void Engine::prepareSaveModule(Module* module) {
|
||||||
|
|
||||||
|
|
||||||
void Engine::prepareSave() {
|
void Engine::prepareSave() {
|
||||||
|
if (internal->aboutToClose)
|
||||||
|
return;
|
||||||
SharedLock<SharedMutex> lock(internal->mutex);
|
SharedLock<SharedMutex> lock(internal->mutex);
|
||||||
for (Module* module : internal->modules) {
|
for (Module* module : internal->modules) {
|
||||||
Module::SaveEvent e;
|
Module::SaveEvent e;
|
||||||
|
|
@ -1175,5 +1178,10 @@ void Engine::startFallbackThread() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Engine_setAboutToClose(Engine* const engine) {
|
||||||
|
engine->internal->aboutToClose = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace engine
|
} // namespace engine
|
||||||
} // namespace rack
|
} // namespace rack
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue