Changeset 14699


Ignore:
Timestamp:
Mar 2, 2016, 7:55:37 AM (6 years ago)
Author:
mikedld
Message:

Prevent crash during group rules removal in some cases (OS X)

The crash seems to be caused by animation performed by the rules list and
the window in parallel. This commit disables window resize animation until
a better solution is devised.

Rules list height is now also limited and scrollbar is shown if needed.

Location:
trunk/macosx
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/GroupsPrefsController.h

    r13162 r14699  
    4040    IBOutlet NSWindow * fGroupRulesSheetWindow;
    4141    IBOutlet NSPredicateEditor * fRuleEditor;
     42
     43    IBOutlet NSLayoutConstraint * fRuleEditorHeightConstraint;
    4244}
    4345
  • trunk/macosx/GroupsPrefsController.m

    r14662 r14699  
    300300- (void) ruleEditorRowsDidChange: (NSNotification *) notification
    301301{
    302     const CGFloat heightDifference = [fRuleEditor numberOfRows] * [fRuleEditor rowHeight] - [fRuleEditor frame].size.height;
    303     NSRect windowFrame = [fRuleEditor window].frame;
    304     windowFrame.size.height += heightDifference;
    305     windowFrame.origin.y -= heightDifference;
    306    
    307     [fRuleEditor.window setFrame: windowFrame display: YES animate: YES];
     302    NSScrollView * ruleEditorScrollView = [fRuleEditor enclosingScrollView];
     303   
     304    const CGFloat rowHeight = [fRuleEditor rowHeight];
     305    const CGFloat bordersHeight = [ruleEditorScrollView frame].size.height - [ruleEditorScrollView contentSize].height;
     306
     307    const CGFloat requiredRowCount = [fRuleEditor numberOfRows];
     308    const CGFloat maxVisibleRowCount = (long)((NSHeight([[[fRuleEditor window] screen] visibleFrame]) * 2 / 3) / rowHeight);
     309   
     310    [fRuleEditorHeightConstraint setConstant: MIN(requiredRowCount, maxVisibleRowCount) * rowHeight + bordersHeight];
     311    [ruleEditorScrollView setHasVerticalScroller: requiredRowCount > maxVisibleRowCount];
    308312}
    309313
  • trunk/macosx/da.lproj/GroupRules.xib

    r14684 r14699  
    1010                <outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
    1111                <outlet property="fRuleEditor" destination="34" id="56"/>
     12                <outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
    1213            </connections>
    1314        </customObject>
     
    188189                        <constraints>
    189190                            <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
    190                             <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="50" id="v6L-SJ-HFk"/>
     191                            <constraint firstAttribute="height" constant="167" id="v6L-SJ-HFk"/>
    191192                        </constraints>
    192193                        <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
  • trunk/macosx/de.lproj/GroupRules.xib

    r14684 r14699  
    1010                <outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
    1111                <outlet property="fRuleEditor" destination="34" id="56"/>
     12                <outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
    1213            </connections>
    1314        </customObject>
     
    188189                        <constraints>
    189190                            <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
    190                             <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="50" id="v6L-SJ-HFk"/>
     191                            <constraint firstAttribute="height" constant="167" id="v6L-SJ-HFk"/>
    191192                        </constraints>
    192193                        <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
  • trunk/macosx/en.lproj/GroupRules.xib

    r14684 r14699  
    1010                <outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
    1111                <outlet property="fRuleEditor" destination="34" id="56"/>
     12                <outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
    1213            </connections>
    1314        </customObject>
     
    188189                        <constraints>
    189190                            <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
    190                             <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="50" id="v6L-SJ-HFk"/>
     191                            <constraint firstAttribute="height" constant="167" id="v6L-SJ-HFk"/>
    191192                        </constraints>
    192193                        <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
  • trunk/macosx/es.lproj/GroupRules.xib

    r14684 r14699  
    1010                <outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
    1111                <outlet property="fRuleEditor" destination="34" id="56"/>
     12                <outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
    1213            </connections>
    1314        </customObject>
     
    188189                        <constraints>
    189190                            <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
    190                             <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="50" id="v6L-SJ-HFk"/>
     191                            <constraint firstAttribute="height" constant="167" id="v6L-SJ-HFk"/>
    191192                        </constraints>
    192193                        <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
  • trunk/macosx/fr.lproj/GroupRules.xib

    r14684 r14699  
    1010                <outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
    1111                <outlet property="fRuleEditor" destination="34" id="56"/>
     12                <outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
    1213            </connections>
    1314        </customObject>
     
    188189                        <constraints>
    189190                            <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
    190                             <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="50" id="v6L-SJ-HFk"/>
     191                            <constraint firstAttribute="height" constant="167" id="v6L-SJ-HFk"/>
    191192                        </constraints>
    192193                        <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
  • trunk/macosx/it.lproj/GroupRules.xib

    r14684 r14699  
    1010                <outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
    1111                <outlet property="fRuleEditor" destination="34" id="56"/>
     12                <outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
    1213            </connections>
    1314        </customObject>
     
    188189                        <constraints>
    189190                            <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
    190                             <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="50" id="v6L-SJ-HFk"/>
     191                            <constraint firstAttribute="height" constant="167" id="v6L-SJ-HFk"/>
    191192                        </constraints>
    192193                        <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
  • trunk/macosx/nl.lproj/GroupRules.xib

    r14684 r14699  
    1010                <outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
    1111                <outlet property="fRuleEditor" destination="34" id="56"/>
     12                <outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
    1213            </connections>
    1314        </customObject>
     
    188189                        <constraints>
    189190                            <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
    190                             <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="50" id="v6L-SJ-HFk"/>
     191                            <constraint firstAttribute="height" constant="167" id="v6L-SJ-HFk"/>
    191192                        </constraints>
    192193                        <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
  • trunk/macosx/pt_PT.lproj/GroupRules.xib

    r14684 r14699  
    1010                <outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
    1111                <outlet property="fRuleEditor" destination="34" id="56"/>
     12                <outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
    1213            </connections>
    1314        </customObject>
     
    188189                        <constraints>
    189190                            <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
    190                             <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="50" id="v6L-SJ-HFk"/>
     191                            <constraint firstAttribute="height" constant="167" id="v6L-SJ-HFk"/>
    191192                        </constraints>
    192193                        <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
  • trunk/macosx/ru.lproj/GroupRules.xib

    r14684 r14699  
    1010                <outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
    1111                <outlet property="fRuleEditor" destination="34" id="56"/>
     12                <outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
    1213            </connections>
    1314        </customObject>
     
    189190                        <constraints>
    190191                            <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
    191                             <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="50" id="v6L-SJ-HFk"/>
     192                            <constraint firstAttribute="height" constant="167" id="v6L-SJ-HFk"/>
    192193                        </constraints>
    193194                        <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
  • trunk/macosx/tr.lproj/GroupRules.xib

    r14684 r14699  
    1010                <outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
    1111                <outlet property="fRuleEditor" destination="34" id="56"/>
     12                <outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
    1213            </connections>
    1314        </customObject>
     
    188189                        <constraints>
    189190                            <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
    190                             <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="50" id="v6L-SJ-HFk"/>
     191                            <constraint firstAttribute="height" constant="167" id="v6L-SJ-HFk"/>
    191192                        </constraints>
    192193                        <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
Note: See TracChangeset for help on using the changeset viewer.