Opened on 03/23/2018 at 10:46:22 AM
#6517 new change
Improve stability when one works with JsWeakValuesID
Reported by: | sergz | Assignee: | |
---|---|---|---|
Priority: | P4 | Milestone: | |
Module: | Libadblockplus | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Platform: | Unknown / Cross platform | |
Ready: | no | Confidential: | no |
Tester: | Unknown | Verified working: | no |
Review URL(s): |
Description
Background
Currently the API basically consists from two methods, storing the values with corresponding creation of their ID and extracting the values by the ID. The way this ID is used right now is pretty simplistic and does not take into account several execution flows, in particular it can happen that the extraction method is not called, e.g. because of an exception or perhaps even just by a condition, thus the stored values will leak until the JsEngine is destroyed.
What to change
Add a generic class which extracts the stored values from JsEngine when it goes out of scope. Add JsValueList JsEngine::GetJsValues(const JsWeakValuesID& id) which allows to obtain the stored values without removing them, analogously to a weak_ptr::lock.