Always create actioncollection
ClosedPublic

Authored by nicolasfella on Apr 13 2020, 5:15 PM.

Details

Summary

Otherwise subclasses that unconditionally use m_actionCollection will get crashes. Observed in D28789

Diff Detail

Repository
R294 KBookmarks
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
nicolasfella created this revision.Apr 13 2020, 5:15 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptApr 13 2020, 5:15 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
nicolasfella requested review of this revision.Apr 13 2020, 5:15 PM
dfaure accepted this revision.Apr 13 2020, 7:45 PM

Thanks.

(but now konqueror creates another one, so the konqueror patch needs to changed to "if exactly 5.69" only, right?)

This revision is now accepted and ready to land.Apr 13 2020, 7:45 PM

(but now konqueror creates another one, so the konqueror patch needs to changed to "if exactly 5.69" only, right?)

makes sense

This revision was automatically updated to reflect the committed changes.
kossebau added inline comments.
src/kbookmarkmenu.cpp
69

This resetting of m_actionCollection in the constructor taking an actionCollection still results in issues, as this KBookmarkMenu constructor taking an actionCollection calls the other constructors not taking an actioncollection, but only resets the m_actionCollection afterwards.

As a result the addActions() call in the other constructor will operate on an actionCollection object which is then hidden here again. And also the actionCollection passed will not have any actions added.

So any code which tries to access actions unconditionally from the actionCollection using the action id, like "add_bookmark", will get a nullptr and then go boom.

Like happens for Konsole which got built still using the old constructor taking a actionCollection, see https://bugs.kde.org/show_bug.cgi?id=420820