https://bugs.kde.org/show_bug.cgi?id=397836
This patch fixed this bug.
Under my implementation, if we are merging a layer that is the source of a clone layer, the clone layer will become the clone of the merged layer.
Under this implementation, merging down will keep all its current behaviours (clones turn into paint layers).
Not only merging, but deleting nodes is also affected.
The real cause of this bug is that when removing a layer, we are using the prevAbove pointer to indicate the position where it has been removed from. In current master, all its clones are converted into paint layers when removing the layer. If the prevAbove pointer is just a clone of the layer to remove, when we restore the layer, KisNode will just refuse to add the layer since prevAbove is not in the parent now (it has been removed and replaced with a paint layer).