| 6943 | } |
| 6944 | |
| 6945 | bool ScriptingObjects::ScriptBackgroundTask::killVoicesAndCall(var loadingFunction) |
| 6946 | { |
| 6947 | if (HiseJavascriptEngine::isJavascriptFunction(loadingFunction)) |
| 6948 | { |
| 6949 | stopThread(timeOut); |
| 6950 | currentTask = WeakCallbackHolder(getScriptProcessor(), this, loadingFunction, 0); |
| 6951 | currentTask.incRefCount(); |
| 6952 | currentTask.addAsSource(this, "backgroundFunction"); |
| 6953 | |
| 6954 | WeakReference<ScriptBackgroundTask> safeThis(this); |
| 6955 | |
| 6956 | auto f = [safeThis](Processor* p) |
| 6957 | { |
| 6958 | if (safeThis != nullptr) |
| 6959 | { |
| 6960 | auto r = safeThis->currentTask.callSync(nullptr, 0, nullptr); |
| 6961 | |
| 6962 | if (!r.wasOk()) |
| 6963 | debugError(p, r.getErrorMessage()); |
| 6964 | } |
| 6965 | |
| 6966 | return SafeFunctionCall::OK; |
| 6967 | }; |
| 6968 | |
| 6969 | return getScriptProcessor()->getMainController_()->getKillStateHandler().killVoicesAndCall(dynamic_cast<Processor*>(getScriptProcessor()), f, MainController::KillStateHandler::TargetThread::SampleLoadingThread); |
| 6970 | } |
| 6971 | |
| 6972 | return false; |
| 6973 | } |
| 6974 | |
| 6975 | ScriptingObjects::ScriptBackgroundTask::ChildProcessData::ChildProcessData(ScriptBackgroundTask& parent_, const String& command_, const var& args_, const var& pf) : |
| 6976 | processLogFunction(parent_.getScriptProcessor(), &parent_, pf, 3), |
no test coverage detected