Fix crash due to changes in KBookmarkMenu
ClosedPublic

Authored by stefanocrocco on Apr 13 2020, 9:17 AM.

Details

Summary

Since version 5.69, KBookmarkMenu doesn't automatically create an action
collection. This causes Konqueror to crash when going on a submenu in
the Bookmarks menu. To avoid it, manually create the action collection.

Also, avoid calling the version of KBookmarkMenu construction which
takes a KActionCollection, as it's deprecated.

Test Plan

Open the bookmarks menu and hover with the mouse on a submenu. Check
that it crashes. Do the same after this change and check it doesn't crash
anymore.

Diff Detail

Repository
R226 Konqueror
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
stefanocrocco requested review of this revision.Apr 13 2020, 9:17 AM
stefanocrocco created this revision.
  • Remove empty line
nicolasfella accepted this revision.Apr 13 2020, 10:01 AM

I guarded all the m_actionCollection usage in kbookmarksmenu.cpp with checks, but didn't check konqbookmarksmenu, sorry.

Given that making KActionCollection optional is not a concern for Konqueror I think this fix is fine

This revision is now accepted and ready to land.Apr 13 2020, 10:01 AM

Well, the problem is that this means the KBookmarks change broke the "behaviour compatibility" promise.
Most likely one or many of the other users of KBookmarkMenu are affected as well, see https://lxr.kde.org/ident?_i=KBookmarkMenu&_remember=1

Shouldn't KBookmarkMenu keep setting m_actionCollection when used "like before", and only do things different when called with a new constructor / flag?

There was also (apparently related) crash in KJots, see D28775: [KJots] Fix bookmarks actions.

This revision was automatically updated to reflect the committed changes.
arojas added a subscriber: arojas.Apr 13 2020, 4:15 PM

Can you push this to 20.04 too please?

Can you push this to 20.04 too please?

Of course, but I'm not sure how to do that (it's the first time I need to push to somewhere different from master). Since I don't want to risk making a mess because of some mistake, could you please tell me how to do it? Thanks

git checkout release/20.04
git cherry-pick -x 078f357bc
git push
git checkout master

git checkout release/20.04
git cherry-pick -x 078f357bc
git push
git checkout master

Thanks. Done

stefanocrocco reopened this revision.Apr 14 2020, 8:25 AM
This revision is now accepted and ready to land.Apr 14 2020, 8:25 AM

Only create the action collection when using KBookmarks 5.69.0

stefanocrocco requested review of this revision.Apr 14 2020, 8:25 AM
dfaure accepted this revision.Apr 14 2020, 8:35 AM
This revision is now accepted and ready to land.Apr 14 2020, 8:35 AM
This revision was automatically updated to reflect the committed changes.

This commit is missing in release/20.04 branch.

Backported: https://commits.kde.org/konqueror/d6e3f653d265acad006ce65455b557b2fb58f251

But this commit doesn't fix a crash, does it? (the crash was when nobody was creating the action collection, iirc)