Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343390 - CTabFolder's getWrappedHeight(Point) method creates a GC for no reason
Summary: CTabFolder's getWrappedHeight(Point) method creates a GC for no reason
Status: RESOLVED FIXED
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 1.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-20 08:15 EDT by Remy Suen CLA
Modified: 2011-05-30 10:47 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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