Bug 360066 - on reboot kate opens a lot of empty instances of itself
Summary: on reboot kate opens a lot of empty instances of itself
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: 17.08.2
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL: https://phabricator.kde.org/D11818
: 372979 (view as bug list)
Depends on:
Reported: 2016-03-04 12:16 UTC by CapsAdmin
Modified: 2018-04-02 16:10 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 18.04


Note You need to log in before you can comment on or make changes to this bug.
Description CapsAdmin 2016-03-04 12:16:33 UTC
I don't know where to put this bug. It seems more related to the way plasma restores last session but it only happens to kate.

I use kate every now and then to edit small files and it seems like every time I do it inserts an empty kate session into the session restore thing. This builds up after a while so currently I have about 80 kate sessions starting up.

Reproducible: Couldn't Reproduce

This has been happening to me even after reinstalling kubuntu. I'm currently using the neon packages.

The session restore thing seems a bit wonky in general, If I close everything and reboot it still opens up things I closed before rebooting. For me it mostly gets in the way so I should disable it but I figured I should report this.
Comment 1 Nate Graham 2017-12-06 20:36:42 UTC
Can confirm in the latest Kate in 17.08.x; I've seen this too. Haven't been able to come up with a reproducible test case, though.
Comment 2 v.vogelhuber 2017-12-07 07:43:50 UTC
I can also confirm that with Kubuntu 17.04 (KDE Plasma 5.9.5 KDE Frameworks 5.31.0). Reproducibility is always. Just open some files in Kate (in one instance, multiple tabs), shutdown the computer, restart it and Kate will reopen a lot of empty sessions (Interestingly with a lot of new empty instances instead of one instance with a lot of empty tabs).
Comment 3 Erik Quaeghebeur 2018-03-16 08:38:37 UTC
Confirmed also with 17.08.3 on Gentoo.
Comment 4 Erik Quaeghebeur 2018-03-20 10:01:35 UTC
*** Bug 372979 has been marked as a duplicate of this bug. ***
Comment 5 Dominik Haumann 2018-03-31 19:51:39 UTC
Proposed fix:
Comment 6 Алексей Шилин 2018-04-02 16:10:52 UTC
Git commit 0a73e00e6dd78e0ad00c79e7e0a3caf71bf4f549 by Алексей Шилин.
Committed on 02/04/2018 at 16:10.
Pushed by aleksejshilin into branch 'Applications/18.04'.

Don't restart the blocking process on session restore

All blocking Kate processes were restarted on session restore which
led to launching (possibly) multiple redundant instances.

This change asks the session manager to not restart such processes.

Note: QObject::connect() is used here because the session manager
can't be accessed directly according to the documentation [1]:

    In Qt, session management requests for action are handled by
    the two signals QGuiApplication::commitDataRequest() and
    QGuiApplication::saveStateRequest(). Both provide a reference
    to a QSessionManager object as argument. The session manager
    can only be accessed in slots invoked by these signals.

 [1] http://doc.qt.io/qt-5/qsessionmanager.html#details
FIXED-IN: 18.04

Test Plan:
  0. Make sure that Plasma is configured to restore previous session
     on startup.
  1. Open Dolphin and create 'test1' and 'test2' text files.
  2. Open 'test1' in Kate from Dolphin.
  3. Open 'test2' in the already running Kate instance from Dolphin.
  4. Log out and back in. Check that there are no redundant Kate
     instances running.

Reviewers: #kate, dhaumann

Reviewed By: #kate, dhaumann

Subscribers: ngraham, dhaumann

Tags: #kate

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

M  +12   -0    kate/main.cpp