CarterLi / iina

The modern video player for macOS with additional features and bug fixes.
https://iina.io
GNU General Public License v3.0
679 stars 29 forks source link

Layout constraint failure in Network Preferences #14

Closed low-batt closed 2 years ago

low-batt commented 2 years ago

System and IINA version:

Expected behavior: UI layout constraints work.

Actual behavior: Clicking on the menu item "IINA / Preferences..." while running under Xcode shows the following new failure:

2022-01-03 17:42:13.340685-0500 IINA[36490:2564917] [Layout] Unable to simultaneously satisfy constraints:
(
    "<NSLayoutConstraint:0x6000025199a0 NSButton:0x16797a080.lastBaseline == NSButton:0x167977940'Enable youtube-dl'.lastBaseline   (active)>",
    "<NSLayoutConstraint:0x600002519540 V:[NSButton:0x16797a080]-(7)-[NSTextField:0x167978d50]   (active)>",
    "<NSLayoutConstraint:0x6000025194f0 V:[NSButton:0x167977940'Enable youtube-dl']-(6)-[NSTextField:0x16797aa50]   (active)>",
    "<NSLayoutConstraint:0x600002519590 V:[NSTextField:0x16797aa50]-(8)-[NSTextField:0x167978d50]   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600002519590 V:[NSTextField:0x16797aa50]-(8)-[NSTextField:0x167978d50]   (active)>

Set the NSUserDefault NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints to YES to have -[NSWindow visualizeConstraints:] automatically called when this happens.  And/or, set a symbolic breakpoint on LAYOUT_CONSTRAINTS_NOT_SATISFIABLE to catch this in the debugger.

I'm expecting this is related to the recent changes to PrefNetworkViewController.xib.

If you follow the instructions in the warning and run with a breakpoint in LAYOUT_CONSTRAINTS_NOT_SATISFIABLE it will show that the failure occurs in PrefNetworkViewController calling layoutSubtreeIfNeeded as should be expected:

var preferenceTabTitle: String {
    view.layoutSubtreeIfNeeded()

Likely some of the size changes have caused constraints to be invalid. Looking at the diffs some of the changes are minor:

- <rect key="frame" x="0.0" y="0.0" width="476" height="78"/>
+ <rect key="frame" x="0.0" y="-2" width="476" height="80"/>

Of course any change can require constraints to be updated.

Were all those changes intended?

Steps to reproduce: Run IINA-plus under Xcode and bring up the preferences window and look for the warnings in the Xcode window.

This is an IINA problem.

How often does this happen? Everytime.