[KBookmarkMenu] Assign m_actionCollection early to prevent crash

Authored by ahmadsamir on May 4 2020, 5:49 PM.

Description

[KBookmarkMenu] Assign m_actionCollection early to prevent crash

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

Reviewers: Frameworks, dfaure, kossebau, nicolasfella

Reviewed By: dfaure

Subscribers: rikmills, kde-frameworks-devel

Tags: Frameworks

Differential Revision: https://phabricator.kde.org/D29427

(cherry picked from commit 8a282319bc9eb6dd73557319cbd59d279493cdab)

Details

Committed
l10n daemon script <scripty@kde.org>May 4 2020, 10:14 PM
Reviewer
dfaure
Differential Revision
D29427: [KBookmarkMenu] Assign m_actionCollection early to prevent crash
Parents
R294:ed6252e21975: GIT_SILENT Commit translations from l10n-kf5
Branches
Unknown
Tags
Unknown
References
tag: v5.70.0-rc2, tag: v5.70.0