mirror of
https://github.com/transmission/transmission.git
synced 2025-12-20 02:18:42 +00:00
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:
@@ -39,6 +39,8 @@
|
|||||||
|
|
||||||
IBOutlet NSWindow * fGroupRulesSheetWindow;
|
IBOutlet NSWindow * fGroupRulesSheetWindow;
|
||||||
IBOutlet NSPredicateEditor * fRuleEditor;
|
IBOutlet NSPredicateEditor * fRuleEditor;
|
||||||
|
|
||||||
|
IBOutlet NSLayoutConstraint * fRuleEditorHeightConstraint;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) addRemoveGroup: (id) sender;
|
- (void) addRemoveGroup: (id) sender;
|
||||||
|
|||||||
@@ -299,12 +299,16 @@
|
|||||||
|
|
||||||
- (void) ruleEditorRowsDidChange: (NSNotification *) notification
|
- (void) ruleEditorRowsDidChange: (NSNotification *) notification
|
||||||
{
|
{
|
||||||
const CGFloat heightDifference = [fRuleEditor numberOfRows] * [fRuleEditor rowHeight] - [fRuleEditor frame].size.height;
|
NSScrollView * ruleEditorScrollView = [fRuleEditor enclosingScrollView];
|
||||||
NSRect windowFrame = [fRuleEditor window].frame;
|
|
||||||
windowFrame.size.height += heightDifference;
|
|
||||||
windowFrame.origin.y -= heightDifference;
|
|
||||||
|
|
||||||
[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
|
@end
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<connections>
|
<connections>
|
||||||
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
||||||
<outlet property="fRuleEditor" destination="34" id="56"/>
|
<outlet property="fRuleEditor" destination="34" id="56"/>
|
||||||
|
<outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
|
||||||
</connections>
|
</connections>
|
||||||
</customObject>
|
</customObject>
|
||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
@@ -187,7 +188,7 @@ Gw
|
|||||||
</clipView>
|
</clipView>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
|
<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>
|
</constraints>
|
||||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
||||||
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<connections>
|
<connections>
|
||||||
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
||||||
<outlet property="fRuleEditor" destination="34" id="56"/>
|
<outlet property="fRuleEditor" destination="34" id="56"/>
|
||||||
|
<outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
|
||||||
</connections>
|
</connections>
|
||||||
</customObject>
|
</customObject>
|
||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
@@ -187,7 +188,7 @@ Gw
|
|||||||
</clipView>
|
</clipView>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
|
<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>
|
</constraints>
|
||||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
||||||
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<connections>
|
<connections>
|
||||||
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
||||||
<outlet property="fRuleEditor" destination="34" id="56"/>
|
<outlet property="fRuleEditor" destination="34" id="56"/>
|
||||||
|
<outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
|
||||||
</connections>
|
</connections>
|
||||||
</customObject>
|
</customObject>
|
||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
@@ -187,7 +188,7 @@ Gw
|
|||||||
</clipView>
|
</clipView>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
|
<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>
|
</constraints>
|
||||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
||||||
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<connections>
|
<connections>
|
||||||
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
||||||
<outlet property="fRuleEditor" destination="34" id="56"/>
|
<outlet property="fRuleEditor" destination="34" id="56"/>
|
||||||
|
<outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
|
||||||
</connections>
|
</connections>
|
||||||
</customObject>
|
</customObject>
|
||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
@@ -187,7 +188,7 @@ Gw
|
|||||||
</clipView>
|
</clipView>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
|
<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>
|
</constraints>
|
||||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
||||||
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<connections>
|
<connections>
|
||||||
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
||||||
<outlet property="fRuleEditor" destination="34" id="56"/>
|
<outlet property="fRuleEditor" destination="34" id="56"/>
|
||||||
|
<outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
|
||||||
</connections>
|
</connections>
|
||||||
</customObject>
|
</customObject>
|
||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
@@ -187,7 +188,7 @@ Gw
|
|||||||
</clipView>
|
</clipView>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
|
<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>
|
</constraints>
|
||||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
||||||
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<connections>
|
<connections>
|
||||||
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
||||||
<outlet property="fRuleEditor" destination="34" id="56"/>
|
<outlet property="fRuleEditor" destination="34" id="56"/>
|
||||||
|
<outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
|
||||||
</connections>
|
</connections>
|
||||||
</customObject>
|
</customObject>
|
||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
@@ -187,7 +188,7 @@ Gw
|
|||||||
</clipView>
|
</clipView>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
|
<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>
|
</constraints>
|
||||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
||||||
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<connections>
|
<connections>
|
||||||
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
||||||
<outlet property="fRuleEditor" destination="34" id="56"/>
|
<outlet property="fRuleEditor" destination="34" id="56"/>
|
||||||
|
<outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
|
||||||
</connections>
|
</connections>
|
||||||
</customObject>
|
</customObject>
|
||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
@@ -187,7 +188,7 @@ Gw
|
|||||||
</clipView>
|
</clipView>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
|
<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>
|
</constraints>
|
||||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
||||||
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<connections>
|
<connections>
|
||||||
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
||||||
<outlet property="fRuleEditor" destination="34" id="56"/>
|
<outlet property="fRuleEditor" destination="34" id="56"/>
|
||||||
|
<outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
|
||||||
</connections>
|
</connections>
|
||||||
</customObject>
|
</customObject>
|
||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
@@ -187,7 +188,7 @@ Gw
|
|||||||
</clipView>
|
</clipView>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
|
<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>
|
</constraints>
|
||||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
||||||
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<connections>
|
<connections>
|
||||||
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
||||||
<outlet property="fRuleEditor" destination="34" id="56"/>
|
<outlet property="fRuleEditor" destination="34" id="56"/>
|
||||||
|
<outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
|
||||||
</connections>
|
</connections>
|
||||||
</customObject>
|
</customObject>
|
||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
@@ -187,7 +188,7 @@ Gw
|
|||||||
</clipView>
|
</clipView>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
|
<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>
|
</constraints>
|
||||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
||||||
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<connections>
|
<connections>
|
||||||
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
<outlet property="fGroupRulesSheetWindow" destination="1" id="17"/>
|
||||||
<outlet property="fRuleEditor" destination="34" id="56"/>
|
<outlet property="fRuleEditor" destination="34" id="56"/>
|
||||||
|
<outlet property="fRuleEditorHeightConstraint" destination="v6L-SJ-HFk" id="nX1-ss-fWF"/>
|
||||||
</connections>
|
</connections>
|
||||||
</customObject>
|
</customObject>
|
||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
@@ -187,7 +188,7 @@ Gw
|
|||||||
</clipView>
|
</clipView>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="430" id="T2h-Cn-ygX"/>
|
<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>
|
</constraints>
|
||||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="33">
|
||||||
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
<rect key="frame" x="-100" y="-100" width="360" height="15"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user