Browse Source

Protect backend from a few late calls after engine close request

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.2.0-RC1
falkTX 4 years ago
parent
commit
e02e1bbe8a
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 16 additions and 5 deletions
  1. +9
    -2
      source/backend/CarlaStandalone.cpp
  2. +7
    -3
      source/frontend/carla_host.py

+ 9
- 2
source/backend/CarlaStandalone.cpp View File

@@ -972,11 +972,15 @@ bool carla_patchbay_disconnect(CarlaHostHandle handle, bool external, uint conne

bool carla_patchbay_set_group_pos(CarlaHostHandle handle, bool external, uint groupId, int x1, int y1, int x2, int y2)
{
CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->engine != nullptr, "Engine is not initialized", false);
CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->engine != nullptr && handle->engine->isRunning(),
"Engine is not running", false);

carla_debug("carla_patchbay_set_group_pos(%p, %s, %u, %i, %i, %i, %i)",
handle, bool2str(external), groupId, x1, y1, x2, y2);

if (handle->engine->isAboutToClose())
return true;

return handle->engine->patchbaySetGroupPos(false, true, external, groupId, x1, y1, x2, y2);
}

@@ -1877,13 +1881,16 @@ const CarlaInlineDisplayImageSurface* carla_render_inline_display(CarlaHostHandl
uint pluginId,
uint32_t width, uint32_t height)
{
CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, nullptr);
CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr && handle->engine->isRunning(), nullptr);

CarlaPlugin* const plugin = handle->engine->getPlugin(pluginId);
CARLA_SAFE_ASSERT_RETURN(plugin != nullptr, nullptr);

carla_debug("carla_render_inline_display(%p, %i, %i, %i)", handle, pluginId, width, height);

if (handle->engine->isAboutToClose())
return nullptr;

switch (plugin->getType())
{
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH


+ 7
- 3
source/frontend/carla_host.py View File

@@ -2767,7 +2767,9 @@ def canvasCallback(action, value1, value2, valueStr):
gCarla.gui.updateMiniCanvasLater()

elif action == patchcanvas.ACTION_GROUP_POSITION:
if gCarla.gui.fIsProjectLoading or not host.is_engine_running():
if gCarla.gui.fIsProjectLoading:
return
if not host.is_engine_running():
return
groupId = value1
x1, y1, x2, y2 = tuple(int(i) for i in valueStr.split(":"))
@@ -2838,8 +2840,10 @@ def canvasCallback(action, value1, value2, valueStr):
gCarla.gui.slot_showPluginActionsMenu()

elif action == patchcanvas.ACTION_INLINE_DISPLAY:
# FIXME
if gCarla.gui.fPluginCount == 0: return
if gCarla.gui.fIsProjectLoading:
return
if not host.is_engine_running():
return
pluginId = value1
width, height = [int(v) for v in valueStr.split(":")]
return host.render_inline_display(pluginId, width, height)


Loading…
Cancel
Save