Jump to content

Copy/Paste Error


Recommended Posts

Hi Rick... not Morty here!


Is it just me or do others get an error when hitting CTRL-C and CTRL-V in quick succession? There is no crash log, just a popup error saying there is an Unauthorised Access Error on OpenClipboard function.  


My suggestion is that when I hit the COPY, the clipboard is locked and data is captured to it... if you hit PASTE before the copy is done, the clipboard is locked and the error occurs. It happens sporadically and it's not linked to say copying a large image section. But I only get it if I CTRL-C-V quickly. Can't there be a wait and retry built into the code?



paintnet 5.0.1 
There was an error getting the image from the clipboard. 
Exception : 
System. UnauthorizedAccessException: OpenClipboard ( ) 

Edited by EjayH
Link to comment
Share on other sites

You're copying from Paint.NET, and pasting into Paint.NET? Shouldn't be possible to get the error in that case, since you can't do anything else while the copying is in progress


I've seen this happen if you copy from, say, Chrome and then do a paste into PDN faster than Chrome is able to copy to the clipboard.


Even if a retry loop is added, it'll only help when the copy operation fits within the timeout/retry loop's duration. The moment you try to copy a larger image, you'll just get the same error. It can't be a bulletproof solution, in other words.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html


Link to comment
Share on other sites


been using it since PSP became bloatware in the late-90's and I found this in about 2003 or 4 if memory serves when I was final year varsity - v1 or 1.1.. then you jumped to v2... but I could be way off... it's too many years ago.  Yesterday I wanted to send a bank payment receipt but wanted to remove my huge bank balance

I'm not sure that your "huge bank balance" or the other personal history you have given is relevant.

It's best to include only pertinent details in problem reports. You write it only once - but it is read by 100s of people.

Link to comment
Share on other sites

  • 2 weeks later...

I can confirm this is an issue, at least with a fast Ctrl c/v on a large image - obviously you might want to copy and paste from a section of an image to duplicate it. Not sure if this error would be easy to get in general use but even on a fast computer it is repeatable - you  get an error about getting the image from the clipboard:



System.UnauthorizedAccessException: OpenClipboard() returned FALSE (5, ERROR_ACCESS_DENIED)
   at PaintDotNet.Interop.WindowsUtil.ThrowWin32Error(String message, Int32 lastWin32Error) in D:\src\pdn\src\Windows\Interop\WindowsUtil.cs:line 24
   at PaintDotNet.SystemLayer.Clipboard.ClipboardTransaction.Create(IClipboard clipboard, HWND hwnd) in D:\src\pdn\src\SystemLayer\Clipboard\ClipboardTransaction.cs:line 62
   at PaintDotNet.Actions.PasteImageAction.<PerformActionImpl>b__5_0() in D:\src\pdn\src\PaintDotNet\Actions\PasteImageAction.cs:line 94
   at PaintDotNet.Runtime.RetryManager.RunMemorySensitiveOperation[T,TFunc](Int32 maxAttempts, TFunc& func) in D:\src\pdn\src\Base\Runtime\RetryManager.cs:line 227
   at PaintDotNet.Actions.PasteImageAction.PerformActionImpl() in D:\src\pdn\src\PaintDotNet\Actions\PasteImageAction.cs:line 91


Application                                          paint.net 5.0.2 (Stable 5.2.8451.6614)
Build Date                                           20 February 2023

Windows 11

Edited by andyz
Link to comment
Share on other sites

@andyz, I'm unable to replicate this on my Ryzen 7950X if I rapidly press Ctrl+C Ctrl+V. If you've got more specific reproduction instructions, please post them.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...