Bug 450873 - Kate crashes when closing many tabs, under a limited number of tabs setting on
Summary: Kate crashes when closing many tabs, under a limited number of tabs setting on
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: application (show other bugs)
Version: Git
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-26 10:58 UTC by Francisco Boni
Modified: 2022-02-26 13:46 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
crash report from kcrash (10.11 KB, text/vnd.kde.kcrash-report)
2022-02-26 10:58 UTC, Francisco Boni
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Francisco Boni 2022-02-26 10:58:08 UTC
Created attachment 147138 [details]
crash report from kcrash

1. Enable a limited number of tabs
2. Close a large amount of tabs simultaneously, preferably via the Document Tree View

OBSERVED RESULT
Segmentation Fault

EXPECTED RESULT
Close all tabs correctly, even under a limited number of tabs setting.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Clear Linux latest
KDE Plasma Version: 5.24.0
KDE Frameworks Version: 5.91.0
Qt Version: 5.12.2 (with community open-source patches)
Kernel: 5.16.11

ADDITIONAL INFORMATION
The bug doesn't replicate if we set "Limit number of tabs" to 0 (unlimited).

Kate compiled from the latest git.
gcc-11.2.0-gd86949f5f5

CXXFLAGS: -ggdb3 -ggnu-pubnames -Og -march=native -mtune=native -Wall -Wl,--as-needed -Wl,--build-id=sha1 -Wl,--enable-new-dtags -Wl,--hash-style=gnu -Wl,-z,now,-z,relro,-z,max-page-size=0x1000,-z,separate-code -mprefer-vector-width=256 -falign-functions=32 -fasynchronous-unwind-tables -fno-stack-protector -fuse-ld=bfd -fuse-linker-plugin -malign-data=cacheline -feliminate-unused-debug-types -mtls-dialect=gnu2 -Wl,-sort-common -Wno-error -Wp,-D_REENTRANT -pipe -fPIC -static-libstdc++ -static-libgcc -pthread
CMAKE_BUILD_TYPE=Release
BUILD_TESTING:BOOL=OFF
Comment 1 Francisco Boni 2022-02-26 11:33:53 UTC
Tentative bug fix and merge request here: https://invent.kde.org/utilities/kate/-/merge_requests/643
Comment 2 Christoph Cullmann 2022-02-26 13:46:21 UTC
Git commit 6b8c0c33abc5f8574065dbec7f669160f0100d58 by Christoph Cullmann, on behalf of Francisco Boni.
Committed on 26/02/2022 at 13:42.
Pushed by cullmann into branch 'master'.

Fix crash when closing multiple tabs if limited number of tabs is enabled

Purge LRU storage must work regardless of CMAKE_BUILD_TYPE. Otherwise
KateTabBar::removeDocument will iterate over (m_docToLruCounterAndHasTab) documents (*doc) that
have been previously destroyed, resulting in segfault. Fixes Bug 450873
(https://bugs.kde.org/show_bug.cgi?id=450873).

M  +3    -2    kate/katetabbar.cpp

https://invent.kde.org/utilities/kate/commit/6b8c0c33abc5f8574065dbec7f669160f0100d58