There were no changes to this code between 2019.0 and 2019.2.
So I'm surprised that this happens. It works fine here.
So we need to find what does not work: either copy or paste (or both)?
So copy the mask, then check the content of the clipboard. Is something in the clipboard? If so, then copy works. If the clipboard is empty (or contains the last content) then copy does not work. (In this case you could please try the follow: Export the mask to a file. Then open the file with an editor and copy the content of the file into the clipboard. Now try to paste the mask from Hugin.
There were no changes to this code between 2019.0 and 2019.2.
So I'm surprised that this happens. It works fine here.
So we need to find what does not work: either copy or paste (or both)?
So copy the mask, then check the content of the clipboard. Is something in the clipboard? If so, then copy works. If the clipboard is empty (or contains the last content) then copy does not work. (In this case you could please try the follow: Export the mask to a file. Then open the file with an editor and copy the content of the file into the clipboard. Now try to paste the mask from Hugin.