Index: src/FilterEngine.cpp |
diff --git a/src/FilterEngine.cpp b/src/FilterEngine.cpp |
index 19a045e7169216533beb3b4cccaf7c965e2724cb..745d1d52b77b9e2bf7e5fde6bb56b48ba135df6f 100644 |
--- a/src/FilterEngine.cpp |
+++ b/src/FilterEngine.cpp |
@@ -265,6 +265,16 @@ void FilterEngine::CreateAsync(const JsEnginePtr& jsEngine, |
jsEngine->RemoveEventCallback("_init"); |
}); |
+ std::weak_ptr<FilterEngine> weakFilterEngine = filterEngine; |
+ filterEngine->SetFilterChangeCallback([weakFilterEngine](const std::string& reason, JsValue&&) |
+ { |
+ auto filterEngine = weakFilterEngine.lock(); |
+ if (!filterEngine) |
+ return; |
+ if (reason == "save") |
+ filterEngine->GetJsEngine()->NotifyLowMemory(); |
+ }); |
+ |
// Lock the JS engine while we are loading scripts, no timeouts should fire |
// until we are done. |
const JsContext context(*jsEngine); |