aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Walther2013-01-29 12:08:52 (EST)
committerEric Moffatt2013-07-24 11:50:23 (EDT)
commit0fefb1651917d957d68e08614823c67752d4d6cd (patch)
treed77e916f4014ced9ddbc8f2807b061e67977f020
parent9bd76f68af3f87aad0c99de0fd623b79eba5ae16 (diff)
downloadeclipse.platform.ui-0fefb1651917d957d68e08614823c67752d4d6cd.zip
eclipse.platform.ui-0fefb1651917d957d68e08614823c67752d4d6cd.tar.gz
eclipse.platform.ui-0fefb1651917d957d68e08614823c67752d4d6cd.tar.bz2
Bug 389012 - Division by zero exception in TrimBarLayoutI20130724-1600
• curLine.spacerCount-- was accidentally done twice. • Don’t modify the contents of curLine because the same TrimLine can be reused in several layout calls. Change-Id: Ic4666a8a4b58d8f458ed59ccb9cc5eda9b2629eb Signed-off-by: Christian Walther <walther@indel.ch>
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/TrimBarLayout.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/TrimBarLayout.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/TrimBarLayout.java
index a7c2094..baeebb6 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/TrimBarLayout.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/TrimBarLayout.java
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Christian Walther (Indel AG) - Bug 399458: Fix layout overlap in line-wrapped trim bar
+ * Christian Walther (Indel AG) - Bug 389012: Fix division by zero in TrimBarLayout
*******************************************************************************/
package org.eclipse.e4.ui.workbench.renderers.swt;
@@ -233,6 +234,8 @@ public class TrimBarLayout extends Layout {
private void tileLine(TrimLine curLine, Rectangle bounds) {
int curX = bounds.x;
int curY = bounds.y;
+ int remainingExtraSpace = curLine.extraSpace;
+ int remainingSpacerCount = curLine.spacerCount;
for (Control ctrl : curLine.ctrls) {
if (ctrl.isDisposed()) {
continue;
@@ -242,7 +245,7 @@ public class TrimBarLayout extends Layout {
// If its a 'spacer' then add any available 'extra' space to it
if (isSpacer(ctrl)) {
- int extra = curLine.extraSpace / curLine.spacerCount--;
+ int extra = remainingExtraSpace / remainingSpacerCount;
if (horizontal) {
ctrlSize.x += extra;
// leave out 4 pixels at the bottom to avoid overlapping the
@@ -253,8 +256,8 @@ public class TrimBarLayout extends Layout {
ctrl.setBounds(curX, curY, curLine.minor, extra);
}
zeroSize = false;
- curLine.extraSpace -= extra;
- curLine.spacerCount--;
+ remainingExtraSpace -= extra;
+ remainingSpacerCount--;
}
if (horizontal) {