Foreign svg on the clipboard is spuriously ungrouped when pasting in V 1.0.2

Summary:

In v 1.0.2, foreign svg that is pasted from the clipboard gets automatically ungrouped (loosing attributes)

detailed description:

I frequently paste in Inkscape documents svg fragments that another application puts on the system clipboard. Once pasted, the fragment appears as a group in Inkscape (as designed), and that group has custom attributes so that the fragment can be re-edited in the foreign app. Up to 1.0.1 this was working perfectly.

In 1.0.2, upon pasting, the group is automatically ungrouped and that ungrouping cannot be undone (and the attributes are lost, breaking my workflow). If, instead of going through the clipboard I save the fragment in a file (attached file sample.svg) and import it, everything is fine (the group is preserved).

I looked at changes that were made in the code between 1.0.1 and 1.0.2 and I suspect 202d57ea is the cause of the issue, because an desktop->selection->ungroup() was added at line 491 in ClipboardManagerImpl::paste, and the change is accompanied by a comment that indicates it is assumed that stuff on the clipboard was put there by Inkscape itself. If my understanding is correct, this kind of assumption breaks exchanging data through the system clipboard because it alters the structure of the data in a way that can't be anticipated by other applications.

steps to reproduce the bug :

In linux, launch Dia, make two objects, group them together, copy and paste in Inkscape.

In Inkscape 1.0.1, you get <g <g <object 1> <object 2> > > (two nested levels of grouping)

In Inkscape 1.0.2 you get <g <object 1> <object 2> > (single level of grouping)

I'm confident this issue is OS-independent, but I only have access to Linux at the moment. Any application that actually places svg on the clipboard should enable to reproduce the issue (maybe copying from an older version of Inkscape would also show the problem).

The app I'm referring to above is not Dia, it's a customized version of GNU TeXmacs. If needed, I can provide a linux AppImage or a windows portable version of it that puts that svg on the clipboard.

Edited by slowphil