Author Topic: macOS, v26 crash on Menu: Edit -> Fill  (Read 441 times)

tuchman

  • Senior Community Member
  • Posts: 144
  • Hero Points: 7
macOS, v26 crash on Menu: Edit -> Fill
« on: October 28, 2021, 07:24:52 pm »
This problem is 100% reproducible, macOS 12
1) Create a file containing only a few spaces
2) Select the very first space
3) Menu: Edit -> Fill
4) Enter '!'
5) Crashes in Qt

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1661
  • Hero Points: 141
Re: macOS, v26 crash on Menu: Edit -> Fill
« Reply #1 on: October 28, 2021, 08:55:38 pm »
Is it an Intel or Apple Silicon system?  We haven't reproduced it with the Big Sur or Monterey systems yet.

Is there a crash report in the Console app that has a stack for the crash?  If so, post that, might give a hint.

And does it crash if you do the same thing after starting SlickEdit from the terminal, like this: open -a SlickEditPro2021.app --args -sc /tmp/empty_config/

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6209
  • Hero Points: 482
Re: macOS, v26 crash on Menu: Edit -> Fill
« Reply #2 on: October 28, 2021, 10:05:45 pm »
I can't reproduce this on macOS 12.0.1 I tried selecting the first space with the keyboard and mouse. No luck.
« Last Edit: October 29, 2021, 01:17:59 am by Clark »

rjpontefract

  • Senior Community Member
  • Posts: 145
  • Hero Points: 7
Re: macOS, v26 crash on Menu: Edit -> Fill
« Reply #3 on: October 29, 2021, 08:41:54 am »
I just tried this on macOS 11.6.1 (intel i7) and I got the following stack:

Code: [Select]
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   QtCore                        0x000000010f53de25 QCoreApplication::notifyInternal(QObject*, QEvent*) + 85
1   QtGui                          0x000000010f7cebec 0x10f6e3000 + 965612
2   QtGui                          0x000000010f70b2d0 0x10f6e3000 + 164560
3   QtGui                          0x000000010f6fba39 0x10f6e3000 + 100921
4   com.apple.AppKit              0x00007fff22db1578 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 6482
5   com.apple.AppKit              0x00007fff22dafa06 -[NSWindow(NSEventRouting) sendEvent:] + 347
6   QtGui                          0x000000010f6fbbd1 0x10f6e3000 + 101329
7   com.apple.AppKit              0x00007fff22dae845 -[NSApplication(NSEvent) sendEvent:] + 2961
8   com.slickedit.SlickEdit        0x000000010ddda55b -[SlickEditApplication sendEvent:] + 171
9   com.apple.AppKit              0x00007fff23086be1 -[NSApplication _handleEvent:] + 65
10  com.apple.AppKit              0x00007fff22c16c8e -[NSApplication run] + 623
11  QtGui                          0x000000010f711d48 0x10f6e3000 + 191816
12  QtCore                        0x000000010f53ae68 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 520
13  QtCore                        0x000000010f53e3ec QCoreApplication::exec() + 188
14  com.slickedit.SlickEdit        0x000000010bf5597c vmain(int, char**) + 3324
15  com.slickedit.SlickEdit        0x000000010d9d110a xmain + 42
16  com.slickedit.SlickEdit        0x000000010bf836e9 main + 9
17  libdyld.dylib                  0x00007fff20342f3d start + 1
« Last Edit: October 29, 2021, 08:46:54 am by rjpontefract »

tuchman

  • Senior Community Member
  • Posts: 144
  • Hero Points: 7
Re: macOS, v26 crash on Menu: Edit -> Fill
« Reply #4 on: October 29, 2021, 02:45:30 pm »
Thanks @rjpontefract for the stack!
My Mac is also Intel i7.

open -a SlickEditPro2021.app --args -sc /tmp/empty_config/
Same behavior  :(
« Last Edit: October 29, 2021, 02:48:24 pm by tuchman »

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1661
  • Hero Points: 141
Re: macOS, v26 crash on Menu: Edit -> Fill
« Reply #5 on: October 29, 2021, 02:55:20 pm »
We're looking at it.  I don't think any of us have reproduced the crash, but on mine I do find the focus is in a weird state after I do that.  SlickEdit still has the focus but it's not in the edit window.  So that may be related to the problem.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6209
  • Hero Points: 482
Re: macOS, v26 crash on Menu: Edit -> Fill
« Reply #6 on: October 29, 2021, 03:12:58 pm »
Can you reproduce this crash in 25.0.2?

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6209
  • Hero Points: 482
Re: macOS, v26 crash on Menu: Edit -> Fill
« Reply #7 on: October 29, 2021, 07:36:49 pm »
Instead of using Edit>Fill... from the menu, execute the "fill-selection" command from the SlickEdit command line. This test could help a lot.

rjpontefract

  • Senior Community Member
  • Posts: 145
  • Hero Points: 7
Re: macOS, v26 crash on Menu: Edit -> Fill
« Reply #8 on: October 29, 2021, 08:17:52 pm »
Hi @tuchman, sorry if I hijacked your post, but I also use macOS so I have an interest in a fix.

Repeating the test with fill-selection works as expected with no abend. 
« Last Edit: October 29, 2021, 08:21:43 pm by rjpontefract »

rjpontefract

  • Senior Community Member
  • Posts: 145
  • Hero Points: 7
Re: macOS, v26 crash on Menu: Edit -> Fill
« Reply #9 on: October 30, 2021, 06:59:58 am »
If it helps, I caught this in LLDB.  Here's the stack trace:
Code: [Select]
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8)
  * frame #0: 0x0000000103738e25 QtCore`QCoreApplication::notifyInternal(QObject*, QEvent*) + 85
    frame #1: 0x00000001039c3bec QtGui`___lldb_unnamed_symbol1943$$QtGui + 76
    frame #2: 0x00000001039002d0 QtGui`___lldb_unnamed_symbol439$$QtGui + 80
    frame #3: 0x00000001038f0a39 QtGui`___lldb_unnamed_symbol165$$QtGui + 41
    frame #4: 0x00007fff22db1578 AppKit`-[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 6482
    frame #5: 0x00007fff22dafa06 AppKit`-[NSWindow(NSEventRouting) sendEvent:] + 347
    frame #6: 0x00000001038f0bd1 QtGui`___lldb_unnamed_symbol169$$QtGui + 113
    frame #7: 0x00007fff22dae845 AppKit`-[NSApplication(NSEvent) sendEvent:] + 2961
    frame #8: 0x0000000101ebd55b vs`-[SlickEditApplication sendEvent:] + 171
    frame #9: 0x00007fff23086be1 AppKit`-[NSApplication _handleEvent:] + 65
    frame #10: 0x00007fff22c16c8e AppKit`-[NSApplication run] + 623
    frame #11: 0x0000000103906d48 QtGui`___lldb_unnamed_symbol512$$QtGui + 2040
    frame #12: 0x0000000103735e68 QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 520
    frame #13: 0x00000001037393ec QtCore`QCoreApplication::exec() + 188
    frame #14: 0x000000010003897c vs`vmain(int, char**) + 3324
    frame #15: 0x0000000101ab410a vs`xmain + 42
    frame #16: 0x00000001000666e9 vs`main + 9
    frame #17: 0x00007fff20342f3d libdyld.dylib`start + 1

Here's the disassembly:
Code: [Select]
    0x103738e1c <+76>:  cmpb   $0x0, -0x41(%rbp)
    0x103738e20 <+80>:  setne  %al
    0x103738e23 <+83>:  jmp    0x103738e46               ; <+118>
->  0x103738e25 <+85>:  movq   0x8(%rbx), %rax
    0x103738e29 <+89>:  movq   0x40(%rax), %r12
    0x103738e2d <+93>:  incl   0x1c(%r12)
    0x103738e32 <+98>:  movq   (%r15), %rax
    0x103738e35 <+101>: movq   %r15, %rdi
    0x103738e38 <+104>: movq   %rbx, %rsi
    0x103738e3b <+107>: movq   %r14, %rdx
    0x103738e3e <+110>: callq  *0x60(%rax)
    0x103738e41 <+113>: decl   0x1c(%r12)
    0x103738e46 <+118>: movq   0x12b213(%rip), %rcx      ; (void *)0x00007fff80620d70: __stack_chk_guard
    0x103738e4d <+125>: movq   (%rcx), %rcx
    0x103738e50 <+128>: cmpq   -0x28(%rbp), %rcx
    0x103738e54 <+132>: jne    0x103738e63               ; <+147>
    0x103738e56 <+134>: addq   $0x30, %rsp
    0x103738e5a <+138>: popq   %rbx
    0x103738e5b <+139>: popq   %r12
    0x103738e5d <+141>: popq   %r14
    0x103738e5f <+143>: popq   %r15
    0x103738e61 <+145>: popq   %rbp
    0x103738e62 <+146>: retq

No surprises that rbx is invalid:
Code: [Select]
(lldb) reg r rbx
     rbx = 0x0000000000000000

I saved a core file from LLDB but it's rather large (985MiB BZIP2'd).  I suspect it would be more use to you as you will have the symbol tables.  If you want it, let me know how I can get it you please.

tuchman

  • Senior Community Member
  • Posts: 144
  • Hero Points: 7
Re: macOS, v26 crash on Menu: Edit -> Fill
« Reply #10 on: October 30, 2021, 08:17:26 am »
1) Fill worked as expected if issued via 'fill-selection'
2) I also reproduced the problem on 25.0.2
3) No idea if this is relevant, but I have installed Qt via brew.
brew ls qt
/opt/brew/Cellar/qt/6.2.0

Process:               vs [69843]
Path:                  /Applications/SlickEditPro2020.app/Contents/MacOS/vs
Identifier:            com.slickedit.SlickEdit
Version:               25.0.2 (25.0.2.0)
Code Type:             X86-64 (Native)
Parent Process:        launchd.developm [1]
User ID:               501
Date/Time:             2021-10-30 09:45:54.2743 +0200
OS Version:            macOS 12.1 (21C25)
Report Version:        12
Bridge OS Version:     6.1 (19P625)
Anonymous UUID:        8EF25407-AC89-4B41-9901-1A498836EB35
Sleep/Wake UUID:       D10253BD-B784-41E8-B72C-29F9E9813AD9
Time Awake Since Boot: 130000 seconds
Time Since Wake:       718 seconds
System Integrity Protection: enabled
Crashed Thread:        0  Dispatch queue: com.apple.main-thread
Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000008
Exception Codes:       0x0000000000000001, 0x0000000000000008
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process:   exc handler [69843]

VM Region Info: 0x8 is not in any region.  Bytes before following region: 4440334328
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
---> 
      __TEXT                      108aa2000-10aece000    [ 36.2M] r-x/r-x SM=COW  ...ents/MacOS/vs

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   QtCore                                  0x10c29fe25 QCoreApplication::notifyInternal(QObject*, QEvent*) + 85
1   QtGui                                   0x10cf63bec 0x10ce78000 + 965612
2   QtGui                                   0x10cea02d0 0x10ce78000 + 164560
3   QtGui                                   0x10ce90a39 0x10ce78000 + 100921
4   AppKit                               0x7ff8160e6d9c -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 7150
5   AppKit                               0x7ff8160e4f8e -[NSWindow(NSEventRouting) sendEvent:] + 352
6   QtGui                                   0x10ce90bd1 0x10ce78000 + 101329
7   AppKit                               0x7ff8160e3d8e -[NSApplication(NSEvent) sendEvent:] + 2962
8   vs                                      0x10a84661b -[SlickEditApplication sendEvent:] + 171
9   AppKit                               0x7ff81639c35f -[NSApplication _handleEvent:] + 65
10  AppKit                               0x7ff815f6414e -[NSApplication run] + 623
11  QtGui                                   0x10cea6d48 0x10ce78000 + 191816
12  QtCore                                  0x10c29ce68 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 520
13  QtCore                                  0x10c2a03ec QCoreApplication::exec() + 188
14  vs                                      0x108ada0e3 vmain(int, char**) + 3027
15  vs                                      0x10a45f31a xmain + 42
16  vs                                      0x108afdb59 main + 9
17  dyld                                    0x10fea34fe start + 462

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6209
  • Hero Points: 482
Re: macOS, v26 crash on Menu: Edit -> Fill
« Reply #11 on: October 30, 2021, 07:00:44 pm »
Try this fix. It fixes the focus problem. Not sure if it will fix the crash. If not, a non-gui solution (fill-selection) will fix it.

Download this macro file and load it. Macro>Load Module...

tuchman

  • Senior Community Member
  • Posts: 144
  • Hero Points: 7
Re: macOS, v26 crash on Menu: Edit -> Fill
« Reply #12 on: November 01, 2021, 08:00:32 am »
I can no longer reproduce the problem.
The macro fix looks good :)

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6209
  • Hero Points: 482
Re: macOS, v26 crash on Menu: Edit -> Fill
« Reply #13 on: November 01, 2021, 12:57:01 pm »
Great!  We will add this as a hot fix