[KBookmarkMenu] Assign m_actionCollection early to prevent crash
ClosedPublic

Authored by ahmadsamir on May 4 2020, 7:33 PM.

Details

Summary

The deprecated ctor that took a KActionCollection param called the new
ctor (that doesn't take an actionCollection before) m_actionCollection was
assigned. This caused the menu actions never to get added to the
actionCollection as it was still nullptr. This caused crashes in
applications that still use the deprecated ctor, e.g. this bug in
konsole https://bugs.kde.org/show_bug.cgi?id=420820.

Since we can't assign m_actionCollection in the initializer list because
then the constructor delegation would follow a member initializer
(info courtsey of the compiler), introduce a helper init method to
reduce code duplication between the two ctor's.

Thanks to Friedrich W. H. Kossebau for figuring it out
https://phabricator.kde.org/D28800#663274.

CCBUG: 420820

Test Plan

make && ctest

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.
ahmadsamir created this revision.May 4 2020, 7:33 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptMay 4 2020, 7:33 PM
ahmadsamir requested review of this revision.May 4 2020, 7:33 PM
ahmadsamir added a subscriber: rikmills.
dfaure accepted this revision.May 4 2020, 9:56 PM
This revision is now accepted and ready to land.May 4 2020, 9:56 PM
This revision was automatically updated to reflect the committed changes.

5.70 wants this as appended commit, no?

Yep, doing it already.