Pinta crashes on expand canvas

Bug #2047021 reported by grofaty
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Pinta
Fix Committed
Undecided
Unassigned

Bug Description

I downloaded Pinta 2.2 development preview from: https://github.com/PintaProject/Pinta/releases/download/dev-preview-builds/Pinta-2.2-dev1576.exe and installed it on Windows 10.

1. Start Pinta and create new image with small width and height.
2. Copy some image to clipboard (I did it with Windows Paint) and make sure image is bigger then the size of new image from step 2.
3. Paste image in Pinta and expand dialog appears. This is first problem. Buttons are located from top-to-bottom, it is usual to be left-to-right.
4. Clicking on "Expand canvas" button and Pinta crashes with error:

System.ArgumentException: '0' cannot be greater than -757.
   at System.Math.ThrowMinMaxException[T](T min, T max)
   at Pinta.Actions.PasteAction.Paste(Document doc, Boolean toNewLayer, PointI pastePosition) in D:\a\Pinta\Pinta\Pinta\Actions\Edit\PasteAction.cs:line 133
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
   at GLib.Internal.MainLoopSynchronizationContext.<>c__DisplayClass1_0.<Post>b__0()
   at GLib.Internal.MainLoopSynchronizationContext.<>c__DisplayClass3_0.<ScheduleAction>b__0()

See attachments.

Revision history for this message
grofaty (grofaty) wrote :
Revision history for this message
grofaty (grofaty) wrote :
description: updated
Revision history for this message
Cameron White (cameronwhite91) wrote :

I haven't been able to reproduce the vertical layout on Windows, but it seems to have a very small width for the dialog somehow in your screenshot?
We are just using https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1-latest/class.MessageDialog.html for the dialog, so don't have much control over its layout

I can reproduce the error message that appears.

Changed in pinta:
milestone: none → 2.2
status: New → Confirmed
Revision history for this message
Cameron White (cameronwhite91) wrote :
Changed in pinta:
status: Confirmed → Fix Committed
Revision history for this message
grofaty (grofaty) wrote :

I see "vertical buttons" issue is the same on Pinta/Ubuntu.

I downloaded the latest release from master repository: https://github.com/PintaProject/Pinta/actions/runs/7278443090/artifacts/1127062967

1. Create new image 800x600.
2. Paint it somehow, I used Paint Bucket and fill it with red color.
3. CTRL+A and CTRL+C to copy image.
4. Close image without saving e.g. CTRL+W
5. Create new image 640x480.
6. CTRL+V to paste the image. Dialog with vertical buttons appear. (If I click on Expand canvas, now crash does not appear any more). See attachment.

It looks to me some setting of this dialog are arranging buttons vertically instead of horizontally.

Revision history for this message
Cameron White (cameronwhite91) wrote :

I can reproduce that now on Ubuntu 23.10, but it doesn't appear on macOS. I think the libadwaita MessageDialog rearranges itself into a vertical layout if it thinks the dialog will be too wide (around 550px from looking through the source code)

I don't think we can control this in general (e.g. translations which might be much longer), but we could change the default string to something shorter like "Don't expand canvas"

Revision history for this message
grofaty (grofaty) wrote :

In my humble opinion most people don't like to read long text in dialog boxes. We should think what should dialog look like if there was no dialog text and only buttons exists.

Buttons:
- Expand canvas --> this is fine
- Cancel --> also fine

- Don't change canvas size --> The negative is actually strange. I haven't ask for expansion, it just happened out of the blue, because pasted image is larger then original canvas size.

What should be the text to actually say: "Do not make any change (and do the best way you can)." in other words "Preserve existing (canvas state)."

What about button name: "Preserve size" or "Existing size".

--------

The second idea is to precise the question.
- currently: The image being pasted is larger than the canvas size. What would you like to do?
- idea: The image being pasted is larger than the canvas size. What would you like to do with the canvas size?

Now buttons can be simpler:
- Expand
- Keep
- Cancel

Or if you prefer longer names:
- Expand canvas
- Keep existing
- Cancel

Revision history for this message
grofaty (grofaty) wrote :

I did some more tests. When image is closed without saving, dialog appears telling you will lose the changes. Exactly the same wording in Text editor.

Buttons in Pinta v2.1.1 (Gtk3):
- Close without Saving | Cancel | Save

Buttons in Pinta v2.2 (Gtk4):
- Cancel | Discard | Save

So using "NOT" word like "Don't expand canvas" is so Gtk3 style. :)

To keep the Gtk4 logic. What do you want to do with canvas size?
- Cancel | Keep | Expand

Revision history for this message
Cameron White (cameronwhite91) wrote :

Yeah, I think the last suggestion sounds good - maybe "Preserve" sounds better for a single word?
- Cancel | Preserve | Expand

Revision history for this message
grofaty (grofaty) wrote :

Yes, "Preserve" feels even better.

After changing button names, can you please also update translation strings. Thanks.

Revision history for this message
Cameron White (cameronwhite91) wrote :

I've updated that in https://github.com/PintaProject/Pinta/commit/fc5d90333f29f4f74f421adbb11ffa4fd744b1fa - it should be synced to Weblate shortly

Revision history for this message
grofaty (grofaty) wrote :

I have downloaded https://github.com/PintaProject/Pinta/actions/runs/7297254067 and installed on Ubuntu.
I can confirm this problem is now fixed. Thanks a lot for fixing this. It looks magical again.

Revision history for this message
Cameron White (cameronwhite91) wrote :

The new strings should be on Weblate now - I realized it was missing some configuration to get it to add new strings from the translation template for each language

Revision history for this message
grofaty (grofaty) wrote :

Yes, I see new translations in Weblate now. Thanks.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.