From 0ffbf44bb2bb9cc27760cd6ec0c8c139ae3e5fea Mon Sep 17 00:00:00 2001 From: Simon Rogers Date: Thu, 25 Jun 2020 12:19:11 +0100 Subject: [PATCH 1/2] Fix html_producer shutdown exception --- src/modules/html/html.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/html/html.cpp b/src/modules/html/html.cpp index ce4576bbcb..6cf1277569 100644 --- a/src/modules/html/html.cpp +++ b/src/modules/html/html.cpp @@ -312,7 +312,10 @@ class cef_task : public CefTask IMPLEMENT_REFCOUNTING(cef_task); }; -void invoke(const std::function& func) { begin_invoke(func).get(); } +void invoke(const std::function& func) { + if (g_cef_executor != nullptr) + begin_invoke(func).get(); +} std::future begin_invoke(const std::function& func) { From 56b6321d81d5dcaeb826b6490a007ab4b98eb7f5 Mon Sep 17 00:00:00 2001 From: Simon Rogers Date: Thu, 25 Jun 2020 12:21:15 +0100 Subject: [PATCH 2/2] Delete html producer when removing a cg layer --- src/modules/html/producer/html_producer.cpp | 1 - src/protocol/amcp/AMCPCommandsImpl.cpp | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/html/producer/html_producer.cpp b/src/modules/html/producer/html_producer.cpp index 2cfa9fc899..bb89aa8059 100644 --- a/src/modules/html/producer/html_producer.cpp +++ b/src/modules/html/producer/html_producer.cpp @@ -366,7 +366,6 @@ class html_client auto name = message->GetName().ToString(); if (name == REMOVE_MESSAGE_NAME) { - // TODO fully remove producer this->close(); { diff --git a/src/protocol/amcp/AMCPCommandsImpl.cpp b/src/protocol/amcp/AMCPCommandsImpl.cpp index af63f637e8..820d01aa84 100644 --- a/src/protocol/amcp/AMCPCommandsImpl.cpp +++ b/src/protocol/amcp/AMCPCommandsImpl.cpp @@ -636,6 +636,11 @@ std::wstring cg_remove_command(command_context& ctx) int layer = std::stoi(ctx.parameters.at(0)); get_expected_cg_proxy(ctx)->remove(layer); + auto producer = spl::make_shared_ptr( + ctx.channel.channel->stage().foreground(ctx.layer_index(core::cg_proxy::DEFAULT_LAYER)).get()); + if (0 == producer->name().compare(L"html")) + ctx.channel.channel->stage().clear(ctx.layer_index(core::cg_proxy::DEFAULT_LAYER)); + return L"202 CG OK\r\n"; }