summaryrefslogtreecommitdiff
blob: c0e68bc8427c763343d0d960ac5116878ec1904d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
From 8504e095478b1c922055fc4ae6c736472708fddd Mon Sep 17 00:00:00 2001
From: Stefano Crocco <stefano.crocco@alice.it>
Date: Mon, 13 Apr 2020 10:53:06 +0200
Subject: [PATCH] Fix crash due to changes in KBookmarkMenu

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.

Reviewers: dfaure, nicolasfella

Reviewed By: nicolasfella

Subscribers: poboiko

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

* asturm, 2020-04-23: This *is* KF-5.69 so no need to check for the
  version wrt commit b61086cf.
---
 src/konqbookmarkmenu.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/konqbookmarkmenu.h b/src/konqbookmarkmenu.h
index 4898c3a..45bdb84 100644
--- a/src/konqbookmarkmenu.h
+++ b/src/konqbookmarkmenu.h
@@ -25,6 +25,8 @@
 #include "kbookmarkactionmenu.h"
 #include "kbookmarkcontextmenu.h"
 
+#include <KActionCollection>
+
 #if KBOOKMARKS_ENABLE_DEPRECATED_SINCE(5, 0)
 #include "kbookmarkowner.h" // for SC reasons
 
@@ -56,8 +58,9 @@ public:
      */
     KBOOKMARKS_DEPRECATED_VERSION(5, 65, "This class has moved to Konqueror")
     KonqBookmarkMenu(KBookmarkManager *mgr, KBookmarkOwner *owner, KBookmarkActionMenu *parentMenu, KActionCollection *collec)
-        : KBookmarkMenu(mgr, owner, parentMenu->menu(), collec)
+        : KBookmarkMenu(mgr, owner, parentMenu->menu())
     {
+        m_actionCollection = collec;
     }
     ~KonqBookmarkMenu() override
     {}
@@ -71,6 +74,7 @@ public:
     KonqBookmarkMenu(KBookmarkManager *mgr, KBookmarkOwner *owner, KBookmarkActionMenu *parentMenu, QString parentAddress)
         : KBookmarkMenu(mgr, owner, parentMenu->menu(), parentAddress)
     {
+        m_actionCollection = new KActionCollection(this);
     }
 
 protected:
-- 
2.26.2