Browse Source

Fix wrong context on UI deletion, needed for macOS hosts using GL

tags/v1.5
falkTX 3 years ago
parent
commit
33c266c595
2 changed files with 19 additions and 0 deletions
  1. +3
    -0
      dpf/distrho/src/DistrhoUIInternal.hpp
  2. +16
    -0
      dpf/distrho/src/DistrhoUIPrivateData.hpp

+ 3
- 0
dpf/distrho/src/DistrhoUIInternal.hpp View File

@@ -108,6 +108,9 @@ public:
~UIExporter() ~UIExporter()
{ {
quit(); quit();
#if !DISTRHO_PLUGIN_HAS_EXTERNAL_UI
uiData->window->enterContextForDeletion();
#endif
delete ui; delete ui;
delete uiData; delete uiData;
} }


+ 16
- 0
dpf/distrho/src/DistrhoUIPrivateData.hpp View File

@@ -183,10 +183,18 @@ public:
if (pData->view == nullptr) if (pData->view == nullptr)
return; return;


// this is called just before creating UI, ensuring proper context to it
if (pData->initPost()) if (pData->initPost())
puglBackendEnter(pData->view); puglBackendEnter(pData->view);
} }


~PluginWindow()
{
if (pData->view != nullptr)
puglBackendLeave(pData->view);
}

// called after creating UI, restoring proper context
void leaveContext() void leaveContext()
{ {
if (pData->view == nullptr) if (pData->view == nullptr)
@@ -199,11 +207,19 @@ public:
puglBackendLeave(pData->view); puglBackendLeave(pData->view);
} }


// used for temporary windows (VST2/3 get size without active/visible view)
void setIgnoreIdleCallbacks(const bool ignore = true) void setIgnoreIdleCallbacks(const bool ignore = true)
{ {
pData->ignoreIdleCallbacks = ignore; pData->ignoreIdleCallbacks = ignore;
} }


// called right before deleting UI, ensuring correct context
void enterContextForDeletion()
{
if (pData->view != nullptr)
puglBackendEnter(pData->view);
}

protected: protected:
void onFocus(const bool focus, const DGL_NAMESPACE::CrossingMode mode) override void onFocus(const bool focus, const DGL_NAMESPACE::CrossingMode mode) override
{ {


Loading…
Cancel
Save