Closing Mudlet clears the clipboard
Brief summary of issue / Description of requested feature:
Closing Mudlet clears the clipboard
Steps to reproduce the issue / Reasons for adding feature:
- Copy anything to the clipboard
- Close Mudlet
- Try to paste text
https://github.com/Mudlet/Mudlet/assets/2612048/92149af3-41ed-4711-9878-e74201c0880f
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.
Tested the above and that's accurate for me too on Win10
Do you get the same behaviour with other applications on Windows when trying to copy similar things?
does not occur for me in notepad, wordpad, or windows explorer that way no.
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?
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.
Maybe try this, more info
ON WINDOWS,the resolution is to call OleFlushClipboard() before closing the application.
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.
Sounds good. Won't be from me though, as I don't c++.
Also, does this happen on other OSes?
Happens on macOS too.