Bug 474431

Summary: Logging to Log Viewer docker hangs with multiple windows open
Product: [Applications] krita Reporter: YRH <yavn.work>
Component: DockersAssignee: Alvin Wong <alvin>
Status: RESOLVED FIXED    
Severity: crash CC: alvin
Priority: NOR Keywords: regression
Version: 5.2.0-beta2   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description YRH 2023-09-11 23:45:17 UTC
To reproduce the hang:

== Repro steps (1)

1. Open Krita.
2. Have Log Docker’s logging enabled.
3. Open a new window.
4. In either window, do something to trigger a log message (open preferences, use a filter, etc).
5. Krita hangs.

== Repro steps (2)

1. Launch Krita
2. Create a New Image
3. Open Settings > Dockers > Log Viewer
4. In Log Viewer, toggle the first button “Enable Logging”
5. Open a new window: Window > New Window
6. Try to click inside the new window – Krita will become unresponsive

freyalupen: This seems to be a regression of commit 17ab9bae.

I have confirmed it happening as of 5d1d1a1c2b0b052a89c8f3bc6785893130e798ae as well.
5.1.5 does not have this bug.
Comment 1 Alvin Wong 2023-09-12 07:41:50 UTC
Git commit 8f0c4e7f2da10b3063e3a74f300fc53a3c11f949 by Alvin Wong.
Committed on 12/09/2023 at 09:41.
Pushed by alvinwong into branch 'master'.

logdocker: Fix infinite tail recursion with multiple windows

Only store the previous message handler returned from the first time
calling qInstallMessageHandler. Calls to qInstallMessageHandler from the
second window will return the same message handler that we set ourself,
which makes an infinite recursion.

Amends 17ab9bae5c78ab7742c41a0776287098b7495170

M  +4    -1    plugins/dockers/logdocker/LogDockerDock.cpp

https://invent.kde.org/graphics/krita/-/commit/8f0c4e7f2da10b3063e3a74f300fc53a3c11f949
Comment 2 Alvin Wong 2023-09-12 07:42:28 UTC
Git commit db3abf3d03f211d4cb5628e77aba7dbfb5844ab0 by Alvin Wong.
Committed on 12/09/2023 at 09:42.
Pushed by alvinwong into branch 'krita/5.2'.

logdocker: Fix infinite tail recursion with multiple windows

Only store the previous message handler returned from the first time
calling qInstallMessageHandler. Calls to qInstallMessageHandler from the
second window will return the same message handler that we set ourself,
which makes an infinite recursion.

Amends 17ab9bae5c78ab7742c41a0776287098b7495170
(cherry picked from commit 8f0c4e7f2da10b3063e3a74f300fc53a3c11f949)

M  +4    -1    plugins/dockers/logdocker/LogDockerDock.cpp

https://invent.kde.org/graphics/krita/-/commit/db3abf3d03f211d4cb5628e77aba7dbfb5844ab0