Tk Source Code

View Ticket
Login
Ticket UUID: 822002
Title: Clipboard is lost on exit
Type: Bug Version: obsolete: 8.4.4
Submitter: lucianoes Created on: 2003-10-12 01:07:20
Subsystem: 52. [clipboard] Assigned To: hobbs
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2004-05-04 05:20:51
Resolution: Duplicate Closed By: hobbs
    Closed on: 2004-05-03 22:20:51
Description:
This report is based on the OS/2 port, likely (and
reportedly) to behave the same in Windows. Unix too???

The current clipboard code is message based.  When you
put something to clipboard, Tk claimes itself the owner
of clipboard.  But it does not put there anything yet
(somebody thought that this is an optimization?!). 
When another application requests clipboard contents,
the owner (Tk) is notified (via a message), and then it
fills the contents. However, if nobody asks, Tk won't
put anything when it exits.

On exit, the owner of the clipboard gets a message
requesting filling the clipboard.  On OS/2 this is
WM_RENDERALL (sp?).  Tk throws this message away; it
should not, and should process it as another message
requesting clipboard contents.

Jeff Hobbs writes at c.l.t.:
"...If you actually do paste the copied data from the
clipboard once, it will remain there after the app
exits.  The one thing that is missing is that Tk
doesn't force the copy onto the
clipboard at app exit.  The reason Tk is lazy in the
copy is to prevent large data sets being copied..."

My personal view is there should be both a "lazy"
method, to "prevent large data sets being copied", and
a "force" method, to make sure the new clipboard
content will be there after an exit. The programmer can
always check the size of the data currently stored in
the clipboard and choose between the "lazy" or "force"
methods on exit.
User Comments: hobbs added on 2004-05-04 05:20:51:
Logged In: YES 
user_id=72656

Fixed, see 939389

lucianoes added on 2003-10-28 21:51:57:
Logged In: YES 
user_id=383744

The attempt to explain what causes the bug was given by an
OS/2 user who obviously understands Tcl's internals a lot
better than I. I just copied and pasted what he said to
provide something to start from, and I did that because J.
Hobbs asked that the issue be submitted as a bug here at SF
and it was I who had brought the issue up.

I know you don't support OS/2, but the bug, drawback or
whatever you call it is there on Windows 98 and seems to
occur on NTs too. Here is how the issue came up at c.l.t.:

http://groups.google.com/groups?th=6b5f259adb5bf76b

I cannot determine if it really qualifies as a bug or a
valid request for improvement.

dkf added on 2003-10-28 18:53:46:
Logged In: YES 
user_id=79902

Clipboards work subtlely differently across different platforms.
It sounds like there's possibly a bug in the OS/2 port, but
that's not maintained by us (at the moment) so you're going
to have to track down who needs to be told about this...

On UNIX, making the clipboard persist after app exit is the
job of a separate applet that talks the standard
message-based protocol.