Bug 456240

Summary: Kate crash on split view "Document close" (double free or corruption)
Product: [Applications] kate Reporter: Yerrey Dev <yerrey>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: christoph
Priority: NOR    
Version First Reported In: Git   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 22.08.0
Sentry Crash Report:
Attachments: Traceback
Better traceback with more debug symbols

Description Yerrey Dev 2022-07-02 13:26:02 UTC
Created attachment 150337 [details]
Traceback

SUMMARY

When attempting to "close document" on a split tab, you crash with an "double free or corruption (out)" error. Backtrace attached.

STEPS TO REPRODUCE
1. Open any document, can be empty. 
2. In the top right corner hit the split button and choose "Split Vertical"
3. On the new opened split, right click the tab header and choose "Close Document"

OBSERVED RESULT
Kate crashes.

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.25.80
KDE Frameworks Version: 5.96.0
Qt Version: 5.15.5
Kate version: Latest Kate master (aa4d2a03ad3e17938565b5a06aec2f158c281b8e)
Comment 1 Yerrey Dev 2022-07-02 13:33:51 UTC
Created attachment 150338 [details]
Better traceback with more debug symbols
Comment 2 Christoph Cullmann 2022-07-02 19:10:31 UTC
I can reproduce, I think we need to use a single shot to call the closeTabRequest inside the menu, else we do delete stuff during event handling.
Comment 3 Christoph Cullmann 2022-07-02 19:31:28 UTC
Git commit d273c1fb6b322c78896a6f3aeb04fda8181264c3 by Christoph Cullmann.
Committed on 02/07/2022 at 19:28.
Pushed by cullmann into branch 'master'.

fix crash on "close document" in menu of tabs

avoid to delete this during event handling

M  +9    -2    apps/lib/kateviewspace.cpp

https://invent.kde.org/utilities/kate/commit/d273c1fb6b322c78896a6f3aeb04fda8181264c3
Comment 4 Christoph Cullmann 2022-07-02 19:32:19 UTC
Thanks for the good report including nice back trace!

Highly appreciated!