Gmic will crash if it is called with a gimp selected region and the preview "zoom in" function is called too often

Steps to reproduce:
1.) Create a new picture in gimp.
2.) Select in gimp a small region of approximately 15x25 pixels.
3.) Call gmic and select filter “Deformations->Cartesian transform”.
4.) Call “zoom in” function in preview three times. Gmic will display “preview may be inaccurate” warning.
5.) Now just call “zoom in” function at least five times and gmic will crash with following message:

GIMP Message

Calling error for procedure ‘gimp-drawable-sub-thumbnail’: Procedure ‘gimp-drwable-sub-tumbnail’
has been called with value ‘0’ for argument ‘src-width’ (#3, type GimpInt32). This value is
out of range.

[instance(0,0,0,0,0000000000000000,non-shared)] CImg::crop(): Empty instance.

I confirm.
I think this will be easy to fix. Thanks for reporting this !

Well, I’ve been over-confident :slight_smile: Looks like this is a bug in the default GimpPreviewWidget, so I can’t do much except prevent the plug-in to crash when the user zooms a lot on a selection.
But you’ll still get the dialog window.

Crash is gone. After 8 times of zooming in gimp is printing out a “out of range” message. If I zoom in addtionally, gimp will be printing another out of range message. But if I zoom out now gimp will be printing another out of range message, which is strange.

However, I think it will be more usable if there is a zooming restriction like in the zoom out function. If I zoom out very often, zoom out button will be disabled and no further zoom out is possible.

So is it possible to restrict zoom in value in the same manner?

BTW: Thanks for your really fast response.

No, actually this is managed by the GimpZoomPreview widget, and limiting the zoom factor would mean modifying the source code for this component, which is a part of the GIMP source code, not G’MIC.