I have recently read about how Xorg is to blame for the infamous bug in which a user cannot copy and paste from a window after they have closed it. And I also know about the planned eventual switch to Wayland as a replacement for X.
If this bug is a result of X, and X will be replaced by Wayland, then is it possible that a fix will come at that time? I'm curious as to whether this is technically possible, and if it's currently in the plans for it.
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:
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:
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 :)