Bug 450347

Summary: MiniBar in toolbar is broken on master
Product: [Applications] okular Reporter: Albert Astals Cid <aacid>
Component: generalAssignee: Okular developers <okular-devel>
Status: RESOLVED FIXED    
Severity: normal CC: nate
Priority: VHI Keywords: regression
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Albert Astals Cid 2022-02-15 22:47:12 UTC
The minibar is not properly showing in the toolbar

It is the cause of the lots of connect warnings on startup.

It is caused by moving the setupViewerActions around too much
Comment 1 Albert Astals Cid 2022-02-15 22:47:41 UTC
Nate said he'd fix it since he broke it ^_^
Comment 2 Bug Janitor Service 2022-02-18 13:19:22 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/okular/-/merge_requests/566
Comment 3 Albert Astals Cid 2022-02-22 23:50:30 UTC
Git commit 9432565ede1599baf9484e66a2f1a335f338cfef by Albert Astals Cid, on behalf of snooxx 💤.
Committed on 22/02/2022 at 23:16.
Pushed by aacid into branch 'master'.

Fix broken page MiniBar

The `MiniBar` normally used to display page numbers and to provide
navigation buttons regressed since 01557c16c4 to only show an empty
non-functional button called "Page Number", along with multiple
warnings:
`QObject::connect(MiniBar, QAction): invalid nullptr parameter`

This is caused by moving `setupViewerActions()` to a place where
`m_miniBar` is not initialized yet, even though it has a runtime
`connect`-dependency on it.

By moving `setupViewerActions()` back, the `MiniBar` starts working
again. Now the `m_addBookmark` action, which is created in that
function, is not available anymore to be passed to the constructor of
`BookmarkList`. To avoid moving the setup of the latter away from the
rest of the sidebar code, only assigning the action to the bookmark
button contained in the `BookmarkList` is deferred to
`setupViewerActions()`.

As requested, any accidental future `nullptr`-access will be handled by
crashing, even in Release builds, by omitting any checks.

Test Plan:

Page numbers show up again in toolbar, no more `connect` warnings.

M  +10   -6    part/bookmarklist.cpp
M  +5    -1    part/bookmarklist.h
M  +4    -3    part/part.cpp

https://invent.kde.org/graphics/okular/commit/9432565ede1599baf9484e66a2f1a335f338cfef