#1579 Clipboard is lost on exit

obsolete: 8.4.4

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.


  • Donal K. Fellows

    Logged In: YES

    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.

  • Luciano

    Luciano - 2003-10-28

    Logged In: YES

    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.:


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

  • Jeffrey Hobbs

    Jeffrey Hobbs - 2004-05-03

    Logged In: YES

    Fixed, see 939389

  • Jeffrey Hobbs

    Jeffrey Hobbs - 2004-05-03
    • status: open --> closed-duplicate

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks