TESTING: Give up on our own context mutex
This commit is contained in:
parent
7d5cfe997d
commit
f34b820000
4 changed files with 15 additions and 32 deletions
|
|
@ -18,7 +18,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "plugin.hpp"
|
#include "plugin.hpp"
|
||||||
#include "../dpf/distrho/extra/Mutex.hpp"
|
#include "DistrhoUtils.hpp"
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------------
|
||||||
// from PluginContext.hpp
|
// from PluginContext.hpp
|
||||||
|
|
@ -36,7 +36,6 @@ struct CardinalPluginContext : rack::Context {
|
||||||
bool playing, frameZero;
|
bool playing, frameZero;
|
||||||
int32_t bar, beat, beatsPerBar;
|
int32_t bar, beat, beatsPerBar;
|
||||||
double tick, ticksPerBeat, ticksPerFrame;
|
double tick, ticksPerBeat, ticksPerFrame;
|
||||||
Mutex mutex;
|
|
||||||
Plugin* const plugin;
|
Plugin* const plugin;
|
||||||
CardinalPluginContext(Plugin* const p);
|
CardinalPluginContext(Plugin* const p);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,6 @@ struct Initializer
|
||||||
std::vector<uint8_t> data(size);
|
std::vector<uint8_t> data(size);
|
||||||
std::memcpy(data.data(), blob, size);
|
std::memcpy(data.data(), blob, size);
|
||||||
|
|
||||||
const MutexLocker cml(context->mutex);
|
|
||||||
rack::contextSet(context);
|
rack::contextSet(context);
|
||||||
rack::system::removeRecursively(context->patch->autosavePath);
|
rack::system::removeRecursively(context->patch->autosavePath);
|
||||||
rack::system::createDirectories(context->patch->autosavePath);
|
rack::system::createDirectories(context->patch->autosavePath);
|
||||||
|
|
@ -287,10 +286,7 @@ struct Initializer
|
||||||
// -----------------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
struct ScopedContext {
|
struct ScopedContext {
|
||||||
const MutexLocker cml;
|
|
||||||
|
|
||||||
ScopedContext(const CardinalBasePlugin* const plugin)
|
ScopedContext(const CardinalBasePlugin* const plugin)
|
||||||
: cml(plugin->context->mutex)
|
|
||||||
{
|
{
|
||||||
rack::contextSet(plugin->context);
|
rack::contextSet(plugin->context);
|
||||||
}
|
}
|
||||||
|
|
@ -400,15 +396,11 @@ public:
|
||||||
fInitializer->oscPlugin = nullptr;
|
fInitializer->oscPlugin = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
rack::contextSet(context);
|
||||||
const MutexLocker cml(context->mutex);
|
|
||||||
rack::contextSet(context);
|
|
||||||
#if defined(__MOD_DEVICES__) && !defined(HEADLESS)
|
#if defined(__MOD_DEVICES__) && !defined(HEADLESS)
|
||||||
delete context->window;
|
delete context->window;
|
||||||
context->window = nullptr;
|
context->window = nullptr;
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
delete context;
|
delete context;
|
||||||
rack::contextSet(nullptr);
|
rack::contextSet(nullptr);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,19 +68,16 @@ class CardinalUI : public UI,
|
||||||
|
|
||||||
struct ScopedContext {
|
struct ScopedContext {
|
||||||
CardinalPluginContext* const context;
|
CardinalPluginContext* const context;
|
||||||
const MutexLocker cml;
|
|
||||||
|
|
||||||
ScopedContext(CardinalUI* const ui)
|
ScopedContext(CardinalUI* const ui)
|
||||||
: context(ui->fContext),
|
: context(ui->fContext)
|
||||||
cml(context->mutex)
|
|
||||||
{
|
{
|
||||||
rack::contextSet(context);
|
rack::contextSet(context);
|
||||||
WindowParametersRestore(context->window);
|
WindowParametersRestore(context->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScopedContext(CardinalUI* const ui, const int mods)
|
ScopedContext(CardinalUI* const ui, const int mods)
|
||||||
: context(ui->fContext),
|
: context(ui->fContext)
|
||||||
cml(context->mutex)
|
|
||||||
{
|
{
|
||||||
rack::contextSet(context);
|
rack::contextSet(context);
|
||||||
rack::window::WindowMods(context->window, mods);
|
rack::window::WindowMods(context->window, mods);
|
||||||
|
|
@ -112,23 +109,20 @@ public:
|
||||||
rack::window::Window* const window = new rack::window::Window;
|
rack::window::Window* const window = new rack::window::Window;
|
||||||
rack::window::WindowInit(window, this);
|
rack::window::WindowInit(window, this);
|
||||||
|
|
||||||
{
|
rack::contextSet(fContext);
|
||||||
const MutexLocker cml(fContext->mutex);
|
|
||||||
rack::contextSet(fContext);
|
|
||||||
|
|
||||||
fContext->scene->removeChild(fContext->scene->menuBar);
|
fContext->scene->removeChild(fContext->scene->menuBar);
|
||||||
fContext->scene->menuBar = rack::app::createMenuBar(getWindow(), getApp().isStandalone());
|
fContext->scene->menuBar = rack::app::createMenuBar(getWindow(), getApp().isStandalone());
|
||||||
fContext->scene->addChildBelow(fContext->scene->menuBar, fContext->scene->rackScroll);
|
fContext->scene->addChildBelow(fContext->scene->menuBar, fContext->scene->rackScroll);
|
||||||
|
|
||||||
fContext->window = window;
|
fContext->window = window;
|
||||||
|
|
||||||
rack::widget::Widget::ContextCreateEvent e;
|
rack::widget::Widget::ContextCreateEvent e;
|
||||||
fContext->scene->onContextCreate(e);
|
fContext->scene->onContextCreate(e);
|
||||||
|
|
||||||
window->step();
|
window->step();
|
||||||
|
|
||||||
rack::contextSet(nullptr);
|
rack::contextSet(nullptr);
|
||||||
}
|
|
||||||
|
|
||||||
WindowParametersSetCallback(window, this);
|
WindowParametersSetCallback(window, this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,6 @@ struct CardinalPluginContext : rack::Context {
|
||||||
bool playing, frameZero;
|
bool playing, frameZero;
|
||||||
int32_t bar, beat, beatsPerBar;
|
int32_t bar, beat, beatsPerBar;
|
||||||
double tick, ticksPerBeat, ticksPerFrame;
|
double tick, ticksPerBeat, ticksPerFrame;
|
||||||
|
|
||||||
Mutex mutex;
|
|
||||||
Plugin* const plugin;
|
Plugin* const plugin;
|
||||||
|
|
||||||
CardinalPluginContext(Plugin* const p)
|
CardinalPluginContext(Plugin* const p)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue