pharo icon indicating copy to clipboard operation
pharo copied to clipboard

RubTextEditor allocates a huge RubEditingArea, around 100GB, by default

Open jordanmontt opened this issue 1 year ago • 3 comments

The RubTextEditor class, that is used in TextMorph is initialized with invalid values.

To reproduce:

  1. Inspect the following expression:
(GrowlMorph openWithContents: 'assa')  editor 
  1. Then, click on the inspector to inspect the textArea instance variable:
image

This should break the image

jordanmontt avatar Aug 30 '24 13:08 jordanmontt

Note that the area of the full bounds of the RubEditingArea is rather large and is related to #defaultMaxExtent for RubAbstractTextArea as follows:

(GrowlMorph openWithContents: 'assa') editor textArea fullBounds area
	= (RubAbstractTextArea defaultMaxExtent // 2 * 50)

So for that RubEditingArea, #inspectionMorph tries to, through #imageForm, make a rather large Form as well (at 4 bytes per pixel, around 100GB).

A commit that’s somewhat related as I mentioned #defaultMaxExtent there as well: commit 853be80e38cab1dc.

Rinzwind avatar Sep 01 '24 23:09 Rinzwind

@Rinzwind should we update the defaultMaxExtent ?

hernanmd avatar Sep 04 '24 21:09 hernanmd

Maybe, but I’m not sure what the value should be to be both large enough to express ‘infinite’ and small enough to avoid a problem in #inspectionMorph. Perhaps #inspectionMorph should instead limit the extent of the form like how #inspectionString limits the size of the string.

Rinzwind avatar Sep 13 '24 19:09 Rinzwind