Mudlet icon indicating copy to clipboard operation
Mudlet copied to clipboard

Closing Mudlet clears the clipboard

Open dt192 opened this issue 2 years ago • 11 comments

Brief summary of issue / Description of requested feature:

Closing Mudlet clears the clipboard

Steps to reproduce the issue / Reasons for adding feature:

  1. Copy anything to the clipboard
  2. Close Mudlet
  3. Try to paste text

https://github.com/Mudlet/Mudlet/assets/2612048/92149af3-41ed-4711-9878-e74201c0880f

dt192 avatar Jan 09 '24 16:01 dt192

A bit more specifically, I can reproduce this only when trying to copy the text from Mudlet itself, if the text in the clipboard came from another source it is not cleared.

demonnic avatar Jan 13 '24 16:01 demonnic

Tested the above and that's accurate for me too on Win10

dt192 avatar Jan 13 '24 17:01 dt192

Do you get the same behaviour with other applications on Windows when trying to copy similar things?

vadi2 avatar Jan 14 '24 13:01 vadi2

does not occur for me in notepad, wordpad, or windows explorer that way no.

demonnic avatar Jan 15 '24 00:01 demonnic

This probably needs checking with another Qt framework using application as it sounds like the data is not making it to the "system" clipboard when the "Copy" action is invoked - so perhaps it is being held internally in either a Mudlet or a Qt library memory area - which will not persist beyond the end of the application - and if it is a Qt thing then we can't do much about it...

Also, given that you seem to be talking about Widows applications - how do other OS's behave?

SlySven avatar Jan 27 '24 02:01 SlySven

I suspect Qt is doing a 'just in time' copy, that is - data isn't actually copied until you need to paste it elsewhere. This would explain why pasting after the app is closed didn't work.

vadi2 avatar Jan 27 '24 08:01 vadi2

Maybe try this, more info ON WINDOWS,the resolution is to call OleFlushClipboard() before closing the application.

dt192 avatar Jan 28 '24 13:01 dt192

That looks right, however what is strange is that Qt already does this: https://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/platforms/win/qclipboard_win.cpp?id=82895982ec31b2c889393e7f386c25d668df6c5e&h=5.14#n312

Nonetheless a PR to test this is welcome.

vadi2 avatar Jan 28 '24 14:01 vadi2

Sounds good. Won't be from me though, as I don't c++.

dt192 avatar Jan 28 '24 15:01 dt192

Also, does this happen on other OSes?

SlySven avatar Jun 24 '24 10:06 SlySven

Happens on macOS too.

KitchenMUD avatar Aug 05 '24 02:08 KitchenMUD