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()
{
quit();
#if !DISTRHO_PLUGIN_HAS_EXTERNAL_UI
uiData->window->enterContextForDeletion();
#endif
delete ui;
delete uiData;
}


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

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

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

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

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

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

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

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


Loading…
Cancel
Save