Well, I don't think it's a bug as such, it's rather a feature which has some unintended consequences :) Moreover, my understanding is that other "clipboard managers", i.e. in Windows and MacOS X, work in a very similar way - when Copy operation is performed, the application just notifies the clipboard manager - "hey, I've got something" without passing the actual data (although in the above mentioned OSes an application can physically store data in the clipboard - XWindow leaves this to a "clipboard manager", which is a separate application).
The reason for this will become clear if you consider that the data copied often needs to be converted from one format to another before being pasted. Example: you're copying a text frame from a publishing program and paste it into the same program - the result preserves the text frame size, borders, transformations etc. Then you paste the same thing into a text processor - the result is some text with rich formatting but obviously the text frame properties are lost because the text processor knows nothing about this. Then you paste the same thing into a text editor - the result is just plain text without any formatting.
Now, how does it work? How does proprietary data format of the publishing program is getting converted to something which the text processor understands or just to plain text? Obviously, the conversion can't be done by the X server because it knows nothing about all the possible data formats, also, the receiving application can't do the conversion for the same reason.
My understanding of the process is that when something is copied, the application notifes the clipboard manager about the formats in which it can provide the data: "hey, I've got something which I can convert to my-proprietary-format, rich text or plain text".
Other application then checks if there's anything in the clipboard in a format which it understands:
if (clipboad.contains_data_in_formats("image", "rich text", "plain text")) {
enable_Paste_menu_item();
}
Then, when Paste action is selected, the end result is that the source application is asked to provide the data in the required format.
When the application is exiting, the standard says it can save the data in the clipboard manager:
If a client needs to exit while owning the CLIPBOARD selection,
it should request the clipboard manager to take over the ownership
of the clipboard, using the SAVE_TARGETS mechanism. If there is no
clipboard manager, or if the SAVE_TARGETS conversion fails, the
application should simply exit.
So, my understanding is, it's responsibility of the application to save the data. As such, it's probably unlikely Wayland will improve anything in this respect :)
parcellite
and the clipboard of will be saved after the windows get closed.