Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on macOS with images in the grid #29

Open
tsekityam opened this issue Mar 25, 2020 · 0 comments
Open

Crash on macOS with images in the grid #29

tsekityam opened this issue Mar 25, 2020 · 0 comments

Comments

@tsekityam
Copy link

Environment

  • macOS 10.15.3
  • Xcode 11.3.1
  • QGrid 5.13.2

Steps to reproduce:

  1. Init a new macOS app project
  2. Add QGrid as dependency
  3. Change the content of ContentView.swift as follows:
    import SwiftUI
    import QGrid
    
    struct Item: Identifiable {
        let id = UUID()
    }
    
    struct ContentView: View {
        let array = Array(repeating: Item(), count: 15)
    
        var body: some View {
            QGrid(array, columns: 3) { value in
                Image("") // empty image is being used for simplicity. Using real image doesn't prevent the crash
            }
        }
    }
    
    
    struct ContentView_Previews: PreviewProvider {
        static var previews: some View {
            ContentView()
        }
    }
  4. Run the app
  5. Resize the app window by dragging

What do I expect

The app window resized.

What did I see

The app crashed with the following log:

2020-03-25 13:26:59.993525+0800 qgrid test[40447:1852701] *** Assertion failure in -[_TtC7SwiftUIP33_A874FC5B9DB530D4375C25AE2AA39DF215HostingClipView setBoundsOrigin:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1894.30.142/AppKit.subproj/NSView.m:5645
2020-03-25 13:26:59.994618+0800 qgrid test[40447:1852701] [General] Invalid parameter not satisfying: !isnan(newOrigin.x)
2020-03-25 13:26:59.998896+0800 qgrid test[40447:1852701] [General] (
	0   CoreFoundation                      0x00007fff2c4f48ab __exceptionPreprocess + 250
	1   libobjc.A.dylib                     0x00007fff627ae805 objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff2c51dd10 +[NSException raise:format:arguments:] + 88
	3   Foundation                          0x00007fff2ec16241 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
	4   AppKit                              0x00007fff296bc20f -[NSView setBoundsOrigin:] + 621
	5   AppKit                              0x00007fff296bbf80 -[NSClipView setBoundsOrigin:] + 42
	6   SwiftUI                             0x00007fff39950033 $s7SwiftUI15HostingClipView33_A874FC5B9DB530D4375C25AE2AA39DF2LLC12setFrameSizeyySo6CGSizeVF + 547
	7   SwiftUI                             0x00007fff39950720 $s7SwiftUI15HostingClipView33_A874FC5B9DB530D4375C25AE2AA39DF2LLC12setFrameSizeyySo6CGSizeVFTo + 48
	8   AppKit                              0x00007fff29687ca2 -[NSView setFrame:] + 423
	9   AppKit                              0x00007fff296e45f0 -[NSScrollView _setContentViewFrame:] + 328
	10  AppKit                              0x00007fff296e3f34 -[NSScrollView _applyContentAreaLayout:] + 1054
	11  AppKit                              0x00007fff296e125e -[NSScrollView tile] + 773
	12  AppKit                              0x00007fff296e0f3c -[NSScrollView _tileWithoutRecursing] + 35
	13  AppKit                              0x00007fff2977ae5b -[NSScrollView _update] + 27
	14  AppKit                              0x00007fff29675cf6 -[NSView setFrameSize:] + 1714
	15  AppKit                              0x00007fff2977abb4 -[NSScrollView setFrameSize:] + 242
	16  AppKit                              0x00007fff29687ca2 -[NSView setFrame:] + 423
	17  SwiftUI                             0x00007fff397f29b3 $s7SwiftUI16PlatformViewHostC012updateHostedD6BoundsyyF + 195
	18  SwiftUI                             0x00007fff397f7245 $s7SwiftUI16PlatformViewHostC6layoutyyFTo + 21
	19  AppKit                              0x00007fff2969d100 _NSViewLayout + 600
	20  AppKit                              0x00007fff2969cba3 -[NSView _layoutSubtreeWithOldSize:] + 388
	21  AppKit                              0x00007fff2969ccfd -[NSView _layoutSubtreeWithOldSize:] + 734
	22  AppKit                              0x00007fff2969ccfd -[NSView _layoutSubtreeWithOldSize:] + 734
	23  AppKit                              0x00007fff2969bfd2 -[NSView _layoutSubtreeIfNeededAndAllowTemporaryEngine:] + 1137
	24  AppKit                              0x00007fff2969ba6e -[NSWindow(NSConstraintBasedLayout) _layoutViewTree] + 148
	25  AppKit                              0x00007fff29698434 -[NSWindow _oldPlaceWindow:fromServer:] + 805
	26  AppKit                              0x00007fff296966dd -[NSWindow _setFrameCommon:display:fromServer:] + 1352
	27  AppKit                              0x00007fff29a1ef8a -[NSWindow(NSWindowResizing) _resizeWithEvent:] + 2664
	28  AppKit                              0x00007fff298f76a6 -[NSTitledFrame attemptResizeWithEvent:] + 177
	29  AppKit                              0x00007fff298f7387 -[NSThemeFrame handleMouseDown:] + 294
	30  AppKit                              0x00007fff29992004 -[NSThemeFrame mouseDown:] + 30
	31  AppKit                              0x00007fff29879b0d -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 4907
	32  AppKit                              0x00007fff297e3c5c -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 2612
	33  AppKit                              0x00007fff297e3005 -[NSWindow(NSEventRouting) sendEvent:] + 349
	34  AppKit                              0x00007fff297e137c -[NSApplication(NSEvent) sendEvent:] + 352
	35  AppKit                              0x00007fff2962d0cf -[NSApplication run] + 707
	36  AppKit                              0x00007fff295ff465 NSApplicationMain + 777
	37  qgrid test                          0x000000010000535d main + 13
	38  libdyld.dylib                       0x00007fff63b1c7fd start + 1
	39  ???                                 0x0000000000000003 0x0 + 3
)
2020-03-25 13:27:00.018820+0800 qgrid test[40447:1852701] It's not legal to call -layoutSubtreeIfNeeded on a view which is already being laid out.  If you are implementing the view's -layout method, you can call -[super layout] instead. Break on void _NSDetectedLayoutRecursion(void) to debug.  This will be logged only once.  This may break in the future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant