Commit c9438fc3 authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

Parent dynamically created actions to actionstoolbar in Settings page

While frameworks/kirigami!95
fixes the issue that things using ActionToolBar crash when actions
disappear, it does not fix the underlying issue with actions
disappearing. This does.

When using createObject(null), a reference to the created object needs
to be kept, otherwise the object gets destroyed. Unfortunately, passing
the object to C++ means the JavaScript engine thinks there are no more
references to the object and it garbage collects the objects. This then
causes a crash since the toolbar wants to access the action. See also

To avoid this, parent the created actions to the ActionToolBar so they
are only deleted when the toolbar is also deleted. Since the actions do
not change, there is no risk that we end up with a lot of dangling
actions here.
parent 03c6b942
......@@ -92,7 +92,7 @@ DiscoverPage {
function mergeActions(moreActions) {
var actions = [makeDefault, addSource]
for(var i in moreActions) {
actions.push(kirigamiAction.createObject(null, {action: moreActions[i]}))
actions.push(kirigamiAction.createObject(actionBar, {action: moreActions[i]}))
return actions;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment