App crashes when pressing backspace in empty TextField #1

Open
opened 2025-10-14 15:43:08 -06:00 by navan · 0 comments
Owner

Originally created by @CleverLemming1337 on 9/14/2025

When pressing backspace in an empty TextField, the app crashes:

💣 Program crashed: System trap at 0x000000019ad10c24
                                                                                
Thread 1 crashed:                                                               
                                                                                
 0 0x000000019ad10c24 closure #1 in closure #1 in closure #1 in _assertionFailure(_:_:file:line:flags:) + 240 in libswiftCore.dylib                             
 1 0x000000019ad10aec closure #1 in closure #1 in _assertionFailure(_:_:file:line:flags:) + 340 in libswiftCore.dylib                                           
 2 0x000000019ad10494 _assertionFailure(_:_:file:line:flags:) + 188 in libswiftCore.dylib                                                                       
 3 0x000000019ae85950 RangeReplaceableCollection<>.removeLast() + 856 in libswiftCore.dylib                                                                     
 4 TextFieldControl.handleEvent(_:) + 424 in TUITest at /.../.build/checkouts/SwiftTUI/Sources/SwiftTUI/View/Views/Unary/TextField.swift:42:23                                                                  
                                                                                
    40│         }                                                               
    41│         if char == 127 {                                                
    42│             self.text.removeLast()                                      
      │                       ▲                                                 
    43│             layer.invalidate()                                          
    44│             return                                                      
                                                                                
 5 Application.handleInput() + 2732 in TUITest at /.../.build/checkouts/SwiftTUI/Sources/SwiftTUI/RunLoop/Application.swift:98:36                                                                               
                                                                                
    96│             exit(0)                                                     
    97│         } else {                                                        
    98│             window.firstResponder?.handleEvent(char)                    
      │                                    ▲                                    
    99│         }                                                               
   100│     }                                                                   
                                                                                
 6 0x0000000189397338 _dispatch_block_async_invoke2 + 148 in libdispatch.dylib  
 7 0x00000001893a185c _dispatch_client_callout + 16 in libdispatch.dylib        
 8 0x000000018938c5e0 _dispatch_continuation_pop + 596 in libdispatch.dylib     
 9 0x000000018939f620 _dispatch_source_latch_and_call + 396 in libdispatch.dylib
10 0x000000018939e2f8 _dispatch_source_invoke + 844 in libdispatch.dylib        
11 0x00000001893901b8 _dispatch_lane_serial_drain + 332 in libdispatch.dylib    
12 0x0000000189390e60 _dispatch_lane_invoke + 440 in libdispatch.dylib          
13 0x000000018939af6c _dispatch_root_queue_drain_deferred_item + 216 in libdispatch.dylib                                                                       
14 0x000000018939a810 _dispatch_kevent_worker_thread + 500 in libdispatch.dylib 
15 0x000000018953be9c _pthread_wqthread + 348 in libsystem_pthread.dylib        
                                                                                
Backtrace took 0.32s                                                            
*Originally created by @CleverLemming1337 on 9/14/2025* When pressing backspace in an empty TextField, the app crashes: ``` 💣 Program crashed: System trap at 0x000000019ad10c24 Thread 1 crashed: 0 0x000000019ad10c24 closure #1 in closure #1 in closure #1 in _assertionFailure(_:_:file:line:flags:) + 240 in libswiftCore.dylib 1 0x000000019ad10aec closure #1 in closure #1 in _assertionFailure(_:_:file:line:flags:) + 340 in libswiftCore.dylib 2 0x000000019ad10494 _assertionFailure(_:_:file:line:flags:) + 188 in libswiftCore.dylib 3 0x000000019ae85950 RangeReplaceableCollection<>.removeLast() + 856 in libswiftCore.dylib 4 TextFieldControl.handleEvent(_:) + 424 in TUITest at /.../.build/checkouts/SwiftTUI/Sources/SwiftTUI/View/Views/Unary/TextField.swift:42:23 40│ } 41│ if char == 127 { 42│ self.text.removeLast() │ ▲ 43│ layer.invalidate() 44│ return 5 Application.handleInput() + 2732 in TUITest at /.../.build/checkouts/SwiftTUI/Sources/SwiftTUI/RunLoop/Application.swift:98:36 96│ exit(0) 97│ } else { 98│ window.firstResponder?.handleEvent(char) │ ▲ 99│ } 100│ } 6 0x0000000189397338 _dispatch_block_async_invoke2 + 148 in libdispatch.dylib 7 0x00000001893a185c _dispatch_client_callout + 16 in libdispatch.dylib 8 0x000000018938c5e0 _dispatch_continuation_pop + 596 in libdispatch.dylib 9 0x000000018939f620 _dispatch_source_latch_and_call + 396 in libdispatch.dylib 10 0x000000018939e2f8 _dispatch_source_invoke + 844 in libdispatch.dylib 11 0x00000001893901b8 _dispatch_lane_serial_drain + 332 in libdispatch.dylib 12 0x0000000189390e60 _dispatch_lane_invoke + 440 in libdispatch.dylib 13 0x000000018939af6c _dispatch_root_queue_drain_deferred_item + 216 in libdispatch.dylib 14 0x000000018939a810 _dispatch_kevent_worker_thread + 500 in libdispatch.dylib 15 0x000000018953be9c _pthread_wqthread + 348 in libsystem_pthread.dylib Backtrace took 0.32s ```
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github/SwiftTUI#1
No description provided.