I don't know where to put this bug, this is neither a gnome nor a kde problem and just happens with the tray icon.
When scim receives another MANAGER message after the embedding handshake is done and the tray window reparented it creates a new tray window that requests to be embedded. There is no proper destroy or unmap event of the older tray windows. This bug never occurs with other gtk+ based apps with a tray icon.
Generally this has a really low priority, I discovered that behaviour due to a fault in my code and a user just reported it back to me.