Unhandled expection when pasting

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

Bug Description

I have got some pasting issues lately on Pinta 2.2-dev master branch.

Time to time, I don't know why, it happens I can not paste the image from Clipboard. I get unhandled expection. In Terminal it is displayed:

Pinta: Unhandled exception
GLib.GException: No compatible transfer format found
   at Pinta.Core.TextEngine.PerformPaste(Clipboard clipboard)
   at Pinta.Tools.TextTool.OnHandlePaste(Document document, Clipboard cb)
   at Pinta.Actions.PasteAction.Paste(Document doc, Boolean toNewLayer, PointI pastePosition)
   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()
Pinta: Unhandled exception
GLib.GException: No compatible transfer format found
   at Pinta.Core.TextEngine.PerformPaste(Clipboard clipboard)
   at Pinta.Tools.TextTool.OnHandlePaste(Document document, Clipboard cb)
   at Pinta.Actions.PasteAction.Paste(Document doc, Boolean toNewLayer, PointI pastePosition)
   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()

I have figure it out a work-around. To open new image and paste into new image and it works.

This may be some late change in source code, because I do not remember having this issue before. Can you please check source code if something related to pasting was added in last few days.

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

It looks like the text tool is intercepting it. I can reproduce that if I'm actually inside the text tool editing, and have an image in the clipboard, but I haven't been able to repro it with the text tool active but not editing

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

https://github.com/PintaProject/Pinta/commit/e600d95fe8159a5498ca10f436b50d6354e90f6c should fix the potential errors when pasting in the text tool if the clipboard has something else

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

I can confirm unhandled expection appears if I try to paste image into Text object.
Can't test the latest commit, some issue on downloading from latest Github for Linux build.

Revision history for this message
grofaty (grofaty) wrote :

I downloaded latest Pinta 2.2-dev from master repository https://github.com/PintaProject/Pinta/actions/runs/7341090720/artifacts/1136849802 on Ubuntu 23.10.

I see now crash does not appear anymore. But... image is not pasted. Probably if user presses the CTRL+V button when Text box is active then paste should be possible (I don't know finalize the text if required).

I have tested the Pinta 2.1.1 on Ubuntu 23.10 and if Text box is active when paste is executed with CTRL+V then image is pasted (Expand dialog appears).

I think I like Pinta 2.1.1 solution. If I want to paste, then I want to paste (and don't want to worry about technicalities of text input box).

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

Yeah, I changed the logic in that commit and had the other opinion :)
My thinking is that if you're actively typing in the text box and try to paste, you probably were expecting to paste text. So if the clipboard happened to contain an image instead, it's unexpected to pull you out of editing (and finalize the text) to paste the image - instead the user should finish typing their text and then paste?

Revision history for this message
grofaty (grofaty) wrote :

I agree, if someone types in text, it can be assumed that he or she is intending to paste the text. But... it can also mean, he or she stopped typing and wants to paste the image. We actually can't be sure, what he or she is doing.

Now it works like, someone is in text field, tries to paste the image and image is not pasted and no error is produced. In this case it looks like program is broken. But... now we require from the user that he or she understands that text is not finalized yet. A concept not really seen on the other programs, like text editors for example. In this case program gets more complicated to use. But in my humble opinion Pinta should be simple to use image editor. If someone wants complicated and powerful, Gimp can be used.

P.S. Similar annoyance is when user selects some area with Rectangle Select and then tries to Paint outside of selection, nothing happens, no error, nothing... It looks like a bug, but it is not, program just restricts to paint outside of selection. This is probably another case, when using Pinta is not simple, but it should be. I just opened a new bug 2047734 report, for this issue, to follow one issue per bug report.

Revision history for this message
Cameron White (cameronwhite91) wrote :
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.