Community
Participate
Working Groups
Build Identifier: M20090917-0800 The fix introduced in Bug# 290547 solves half of the problem, here i will explain the remaining half: A grid has five colulmns and three column groups. The first ColumnGroup contains the first column only. The second group contains the next 3 columns, and the 3rd group contains the last column. The current code causes an SWT error: for (int i = 0; i < order.length; i++) { GridColumn col = getColumn(order[i]); if (currentGroup != null) { if (col.getColumnGroup() != currentGroup && colsInGroup > 0 ) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); } else { colsInGroup--; if (colsInGroup <= 0) { currentGroup = null; } } } else if (col.getColumnGroup() != null) { currentGroup = col.getColumnGroup(); colsInGroup = currentGroup.getColumns().length - 1; } } } Analysis: After the first iteration, currentGroup is set to the 1st group, colsInGroup is set to 0. After the 2nd iteration, currentGroup is set to null, colsInGroup is set to -1. After the 3rd iteration, currentGroup is set to 2ndGroup. colsInGroup is set to 2 (which is wrong since we are already in the 2nd column in the current group..). After the 4rd iteration, currentGroup is set to 2ndGroup. colsInGroup is set to 1 In the fifth iteration -> crash (since we have a new group but colsInGroup is still > 0). patch: for (int i = 0; i < order.length; i++) { GridColumn col = getColumn(order[i]); if (currentGroup != null) { if (col.getColumnGroup() != currentGroup) { if (colsInGroup > 0 ) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); } else { currentGroup = col.getColumnGroup(); if (currentGroup != null) { colsInGroup = currentGroup.getColumns().length - 1; } } } else { colsInGroup--; if (colsInGroup <= 0) { currentGroup = null; } } } else if (col.getColumnGroup() != null) { currentGroup = col.getColumnGroup(); colsInGroup = currentGroup.getColumns().length - 1; } } } Reproducible: Always Steps to Reproduce: create a group with five colulmns and three column groups. The first ColumnGroup contains the first column only. The second group contains the next 3 columns, and the 3rd group contains the last column.
Created attachment 183554 [details] The code Grid.java including the bug fix
This bug does not have a target milestone assigned and is automatically closed as part of the 2.3.0 release cleanup. It could be that this bug is accidentally closed for which we apologize. If this bug is still relevant, please re-open and set a target milestone.