Skip to content

Commit 2ea02e2

Browse files
committed
Stackoverflow fix in ImageDescriptor
Fixes getImageData(100) calling itself endlessly (introduced via c2fe144 ) by reintroducing the bigger getImageData(100) and getImageData() endlessly (introduced in 2017 via e6d12ca ) that wasn't experienced thanks to the *happy accident* that it was asbtract method and all implementations before that had their own and every implementor since then most likely figured the endless loop while developing. Enhanced documentation to mention that.
1 parent 4f687d6 commit 2ea02e2

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDescriptor.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -430,24 +430,26 @@ public ImageData getImageData(int zoom) {
430430
}
431431

432432
/**
433-
* Creates and returns a new SWT <code>ImageData</code> object
434-
* for this image descriptor.
435-
* Note that each call returns a new SWT image data object.
433+
* Creates and returns a new SWT <code>ImageData</code> object for this image
434+
* descriptor. Note that each call returns a new SWT image data object.
436435
* <p>
437-
* This framework method is declared public so that it is
438-
* possible to request an image descriptor's image data without
439-
* creating an SWT image object.
436+
* This framework method is declared public so that it is possible to request an
437+
* image descriptor's image data without creating an SWT image object.
440438
* </p>
441439
* <p>
442440
* Returns <code>null</code> if the image data could not be created.
443441
* </p>
444442
* <p>
445-
* This method was abstract until 3.13. Clients should stop re-implementing
446-
* this method and should re-implement {@link #getImageData(int)} instead.
443+
* This method was abstract until 3.13. Clients should stop re-implementing this
444+
* method and should re-implement {@link #getImageData(int)} instead.
447445
* </p>
448446
*
449447
* @return a new image data or <code>null</code>
450-
* @deprecated Use {@link #getImageData(int)} instead.
448+
* @deprecated Use {@link #getImageData(int)} instead. <b>Note: Calling this
449+
* method may result in stack overflow if subclass doesn't override
450+
* either {@link #getImageData()} or {@link #getImageData(int)} to
451+
* prevent endless cycle between the 2 implementation in this class
452+
* since 2017.</b>
451453
*/
452454
@Deprecated
453455
public ImageData getImageData() {

0 commit comments

Comments
 (0)