Rectangle selection tool freezes UI
GIMP version: 2.10.12 Reproduced at least back to first 2.10 release.
Operating System:
- Windows 10
- Linux (Ubuntu 16.04, Ubuntu 18.04)
Package:
- Windows : Installer from gimp.org
- Linux : flatpak
Context
Hi everyone :)
I contacted you a while back in the mailing list, but never followed up (sorry...) about a bug on rectangle selection tool. Thanks to the Hacktoberfest, Genymobile (my company) is giving me a full day to contribute to open source projects we use and love. So here is the first step: a bug report.
Description of the bug
The bug is located in the Rectangle Selection Tool. Reproduction can be a bit tricky, so I also made a video.
What happen is that, given some circumstances, when resizing the rectangle selection, the whole UI/GIMP freezes, leave no other choice but force-closing it. This happens when upper-left rectangle coordinates are odd.
Reproduction
Always
Reproduction steps:
- Given a blank image (2480px * 3508px) (attached)
- When using the Rectangle Selection Tool
- Activate "Fixed" rule, set to "Aspect ratio"
- Create an initial rectangle, which will be a square
- Move the rectangle until upper-left corner coordinates are odd numbers
- Using the Tool UI, set its width to 2480, then press enter.
- Then, the UI/GIMP is frozen
Expected result:
Selection is set to a 2480px * 2480px square
Actual result:
UI/GIMP freezes
Additional information
I started investigating the bug a while back, so I may have a few pointers on the issue. This seems to be related to double rounding on the square coordinates (PROP_X, PROP_Y, PROP_WIDTH, PROP_HEIGHT). I know that switching to integer coordinates fixes the issue (did that a while back, but it broke other things).
Also, if this is really a rounding issue, other tools may also have the same behavior (not tested).
It's mid-day here, when I post this bug, and I still did not managed to rebuild GIMP on my Linux. I have another 4 hours ahead, so I'll keep you posted if I have some more info (and maybe, a fix).