Bug 466571

Summary: Kate crashes on MacOS when using the "Save Copy As..." menu option
Product: [Applications] kate Reporter: Kristen <codestuff>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: 22.12.2   
Target Milestone: ---   
Platform: macOS (DMG)   
OS: macOS   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Full-length crash report, generated by macOS

Description Kristen 2023-02-28 00:03:38 UTC
Created attachment 156813 [details]
Full-length crash report, generated by macOS

SUMMARY
***
When using "Save Copy As..." under the "File" menu, Kate first prompts for a location to save the copy, then crashes once a location to save to has been provided. (On MacOS)
***


STEPS TO REPRODUCE
1. Create or open a file with some code in Kate
2. Click "Save Copy As..." under the "File" menu
3. Enter a location to save the file and click "Save"

OBSERVED RESULT

Kate crashes

EXPECTED RESULT

A copy of the file being created in the specified location.

SOFTWARE/OS VERSIONS

macOS: MacOS Monterey 12.2.1
The "Components" tab under "About Kate" says:
* KDE Frameworks Version 5.103.0
* Qt Version 5.15.8 (built against 5.15.8)
* The cocoa windowing system
Kate installed from a .dmg file of the most recent stable build

ADDITIONAL INFORMATION

This crash appears to be specific to the "Save Copy As..." option - taking the same steps with the "Save As..." option does not cause a crash.

The crash report generated by macOS included the following (full length crash report included as an attachment):
Crashed Thread:        8  KIO::WorkerThread

Exception Type:        EXC_BAD_ACCESS (SIGBUS)
Exception Codes:       KERN_PROTECTION_FAILURE at 0x000000030a196ff8
Exception Codes:       0x0000000000000002, 0x000000030a196ff8
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace SIGNAL, Code 10 Bus error: 10
Terminating Process:   exc handler [38847]

VM Region Info: 0x30a196ff8 is in 0x30a196000-0x30a197000;  bytes after start: 4088  bytes before end: 7
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      Stack                       30a111000-30a196000    [  532K] rw-/rwx SM=PRV  thread 5
--->  Stack Guard                 30a196000-30a197000    [    4K] ---/rwx SM=NUL  
      Stack                       30a197000-30a219000    [  520K] rw-/rwx SM=PRV
Comment 1 Bug Janitor Service 2023-03-01 15:53:18 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/490
Comment 2 Christoph Cullmann 2023-03-02 21:02:04 UTC
Git commit 7f2dd9de8e2a70496de8275a4c16067942926620 by Christoph Cullmann, on behalf of Waqar Ahmed.
Committed on 02/03/2023 at 20:42.
Pushed by cullmann into branch 'master'.

documentSaveCopyAs: Use async job api

exec can have unintended and hard to understand side effects, and in this
case we can just the async api easily as there is no need for blocking

M  +17   -16   src/document/katedocument.cpp
M  +1    -1    src/document/katedocument.h

https://invent.kde.org/frameworks/ktexteditor/commit/7f2dd9de8e2a70496de8275a4c16067942926620
Comment 3 Waqar Ahmed 2023-03-03 06:42:37 UTC
Git commit cbec4b03ebd467a98f1dff44ad1ce0ee11088950 by Waqar Ahmed.
Committed on 03/03/2023 at 06:42.
Pushed by waqar into branch 'kf5'.

documentSaveCopyAs: Use async job api

exec can have unintended and hard to understand side effects, and in this
case we can just the async api easily as there is no need for blocking

M  +17   -16   src/document/katedocument.cpp
M  +1    -1    src/document/katedocument.h

https://invent.kde.org/frameworks/ktexteditor/commit/cbec4b03ebd467a98f1dff44ad1ce0ee11088950