Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 343390

Summary: CTabFolder's getWrappedHeight(Point) method creates a GC for no reason
Product: [Eclipse Project] e4 Reporter: Remy Suen <remy.suen>
Component: UIAssignee: Project Inbox <e4.ui-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: gheorghe
Version: 1.0   
Target Milestone: 4.1   
Hardware: All   
OS: All   
Whiteboard:

Description Remy Suen CLA 2011-04-20 08:15:46 EDT
It's not clear to me why a GC is created and then disposed.

int getWrappedHeight (Point size) {
  boolean[][] positions = new boolean[1][];
  GC gc = new GC(this);
  Rectangle[] rects = computeControlBounds(size, positions);
  gc.dispose();
  int minY = Integer.MAX_VALUE, maxY = 0, wrapHeight = 0;
  for (int i = 0; i < rects.length; i++) {
    if (positions[0][i]) {
      minY = Math.min(minY, rects[i].y);
      maxY = Math.max(maxY, rects[i].y + rects[i].height);
      wrapHeight = maxY - minY;
    }
  }
  return wrapHeight;
}
Comment 1 Bogdan Gheorghe CLA 2011-04-26 20:33:38 EDT
Fixed in HEAD > 20110426