Bug 419982

Summary: --print-and-exit argument leads to two consecutive diaoluges of printing for a single file
Product: [Applications] okular Reporter: Ashish <ash110601ish>
Component: printingAssignee: Okular developers <okular-devel>
Status: RESOLVED FIXED    
Severity: normal CC: aacid, ash110601ish
Priority: NOR    
Version First Reported In: 1.9.3   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Ashish 2020-04-12 08:04:09 UTC
SUMMARY
When Okular is already running and "open new files in a tab" is on in setting running okular --print-and-exit "some file" eventually kills the already existing instance of okular and printing dialogue is instanced two times.
First in the already existing window and then in a separate one.

STEPS TO REPRODUCE
1. Open okular. Make sure that "new files open in a tab" settings is checked. Also make sure that "Confirm on exit with multiple tabs" is off.
2. Open a file in okular.
3. Remaining in the same workspace (virtual desktop), Open a terminal and type okular --print-and-exit "some file"

OBSERVED RESULT
The printing dialogue opens twice. Once the file preview opens in the existing okular session and the other time it opens in a new window. After printing or cancelling in the first case the main window will all other tabs is killed.

EXPECTED RESULT
The printing dialogue opens just once and the preview is shown in a new window not interfering with the already existing instance.

SOFTWARE/OS VERSIONS 
Linux: i3 window manager
Qt Version: 5.18

ADDITIONAL INFORMATION
I don't use KDE Plasma. I use a tiling window manager i3.
Comment 1 Ashish 2020-04-12 08:06:56 UTC
"qt.qpa.xcb: QXcbConnection: XCB error: 5 (BadAtom), sequence: 1021, resource id: 0, major code: 19 (DeleteProperty), minor code: 0" error message also pops op at the end.
Comment 3 Albert Astals Cid 2020-06-01 10:00:34 UTC
Git commit eee401946bf6245b2334164dfb47008f6ba49c26 by Albert Astals Cid.
Committed on 30/05/2020 at 17:42.
Pushed by aacid into branch 'release/20.04'.

Don't attach to another instance if we're going to exit

It's rude to exit someone else we just attached to

M  +5    -0    shell/okular_main.cpp

https://invent.kde.org/graphics/okular/commit/eee401946bf6245b2334164dfb47008f6ba49c26