fix: Prevent same pl runtime from running simultaneously when loading provider
This commit is contained in:
parent
ee2838bada
commit
1c52e0018a
@ -17,6 +17,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
struct {
|
||||
std::string sourceCode;
|
||||
std::mutex runtimeMutex;
|
||||
std::unique_ptr<pl::PatternLanguage> runtime;
|
||||
bool executionDone = true;
|
||||
} patternLanguage;
|
||||
|
@ -123,6 +123,7 @@ namespace hex::plugin::builtin {
|
||||
data.sourceCode = this->m_textEditor.GetText();
|
||||
}
|
||||
|
||||
std::scoped_lock lock(data.runtimeMutex);
|
||||
auto &runtime = data.runtime;
|
||||
|
||||
auto mimeType = magic::getMIMEType(provider);
|
||||
@ -830,6 +831,7 @@ namespace hex::plugin::builtin {
|
||||
EventManager::post<EventHighlightingChanged>();
|
||||
|
||||
TaskManager::createTask("hex.builtin.view.pattern_editor.evaluating", TaskManager::NoProgress, [this, &patternLanguage, code](auto &task) {
|
||||
std::scoped_lock lock(patternLanguage.runtimeMutex);
|
||||
auto &runtime = patternLanguage.runtime;
|
||||
|
||||
task.setInterruptCallback([&runtime] { runtime->abort(); });
|
||||
|
Loading…
x
Reference in New Issue
Block a user