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.
This commit is contained in:
parent
67a03bcabb
commit
109b9ae329
|
@ -39,6 +39,8 @@
|
|||
|
||||
IBOutlet NSWindow * fGroupRulesSheetWindow;
|
||||
IBOutlet NSPredicateEditor * fRuleEditor;
|
||||
|
||||
IBOutlet NSLayoutConstraint * fRuleEditorHeightConstraint;
|
||||
}
|
||||
|
||||
- (void) addRemoveGroup: (id) sender;
|
||||
|
|
|
@ -299,12 +299,16 @@
|
|||
|
||||
- (void) ruleEditorRowsDidChange: (NSNotification *) notification
|
||||
{
|
||||
const CGFloat heightDifference = [fRuleEditor numberOfRows] * [fRuleEditor rowHeight] - [fRuleEditor frame].size.height;
|
||||
NSRect windowFrame = [fRuleEditor window].frame;
|
||||
windowFrame.size.height += heightDifference;
|
||||
windowFrame.origin.y -= heightDifference;
|
||||
NSScrollView * ruleEditorScrollView = [fRuleEditor enclosingScrollView];
|
||||
|
||||
[fRuleEditor.window setFrame: windowFrame display: YES animate: YES];
|
||||
const CGFloat rowHeight = [fRuleEditor rowHeight];
|
||||
const CGFloat bordersHeight = [ruleEditorScrollView frame].size.height - [ruleEditorScrollView contentSize].height;
|
||||
|
||||
const CGFloat requiredRowCount = [fRuleEditor numberOfRows];
|
||||
const CGFloat maxVisibleRowCount = (long)((NSHeight([[[fRuleEditor window] screen] visibleFrame]) * 2 / 3) / rowHeight);
|
||||
|
||||
[fRuleEditorHeightConstraint setConstant: MIN(requiredRowCount, maxVisibleRowCount) * rowHeight + bordersHeight];
|
||||
[ruleEditorScrollView setHasVerticalScroller: requiredRowCount > maxVisibleRowCount];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<connections>
|
||||
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
||||
<outlet property="fRuleEditor" destination="34" id="56"/>
|
||||
<outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
|
@ -187,7 +188,7 @@ Gw
|
|||
</clipView>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
|
||||
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="50" id="v6L-SJ-HFk"/>
|
||||
<constraint firstAttribute="height" constant="167" id="v6L-SJ-HFk"/>
|
||||
</constraints>
|
||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
||||
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<connections>
|
||||
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
||||
<outlet property="fRuleEditor" destination="34" id="56"/>
|
||||
<outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
|
@ -187,7 +188,7 @@ Gw
|
|||
</clipView>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
|
||||
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="50" id="v6L-SJ-HFk"/>
|
||||
<constraint firstAttribute="height" constant="167" id="v6L-SJ-HFk"/>
|
||||
</constraints>
|
||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
||||
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<connections>
|
||||
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
||||
<outlet property="fRuleEditor" destination="34" id="56"/>
|
||||
<outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
|
@ -187,7 +188,7 @@ Gw
|
|||
</clipView>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
|
||||
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="50" id="v6L-SJ-HFk"/>
|
||||
<constraint firstAttribute="height" constant="167" id="v6L-SJ-HFk"/>
|
||||
</constraints>
|
||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
||||
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<connections>
|
||||
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
||||
<outlet property="fRuleEditor" destination="34" id="56"/>
|
||||
<outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
|
@ -187,7 +188,7 @@ Gw
|
|||
</clipView>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
|
||||
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="50" id="v6L-SJ-HFk"/>
|
||||
<constraint firstAttribute="height" constant="167" id="v6L-SJ-HFk"/>
|
||||
</constraints>
|
||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
||||
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<connections>
|
||||
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
||||
<outlet property="fRuleEditor" destination="34" id="56"/>
|
||||
<outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
|
@ -187,7 +188,7 @@ Gw
|
|||
</clipView>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
|
||||
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="50" id="v6L-SJ-HFk"/>
|
||||
<constraint firstAttribute="height" constant="167" id="v6L-SJ-HFk"/>
|
||||
</constraints>
|
||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
||||
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<connections>
|
||||
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
||||
<outlet property="fRuleEditor" destination="34" id="56"/>
|
||||
<outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
|
@ -187,7 +188,7 @@ Gw
|
|||
</clipView>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
|
||||
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="50" id="v6L-SJ-HFk"/>
|
||||
<constraint firstAttribute="height" constant="167" id="v6L-SJ-HFk"/>
|
||||
</constraints>
|
||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
||||
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<connections>
|
||||
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
||||
<outlet property="fRuleEditor" destination="34" id="56"/>
|
||||
<outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
|
@ -187,7 +188,7 @@ Gw
|
|||
</clipView>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
|
||||
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="50" id="v6L-SJ-HFk"/>
|
||||
<constraint firstAttribute="height" constant="167" id="v6L-SJ-HFk"/>
|
||||
</constraints>
|
||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
||||
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<connections>
|
||||
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
||||
<outlet property="fRuleEditor" destination="34" id="56"/>
|
||||
<outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
|
@ -187,7 +188,7 @@ Gw
|
|||
</clipView>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
|
||||
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="50" id="v6L-SJ-HFk"/>
|
||||
<constraint firstAttribute="height" constant="167" id="v6L-SJ-HFk"/>
|
||||
</constraints>
|
||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
||||
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<connections>
|
||||
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
||||
<outlet property="fRuleEditor" destination="34" id="56"/>
|
||||
<outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
|
@ -187,7 +188,7 @@ Gw
|
|||
</clipView>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
|
||||
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="50" id="v6L-SJ-HFk"/>
|
||||
<constraint firstAttribute="height" constant="167" id="v6L-SJ-HFk"/>
|
||||
</constraints>
|
||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
||||
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<connections>
|
||||
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
||||
<outlet property="fRuleEditor" destination="34" id="56"/>
|
||||
<outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
|
@ -187,7 +188,7 @@ Gw
|
|||
</clipView>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
|
||||
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="50" id="v6L-SJ-HFk"/>
|
||||
<constraint firstAttribute="height" constant="167" id="v6L-SJ-HFk"/>
|
||||
</constraints>
|
||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
||||
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
||||
|
|
Loading…
Reference in New Issue