Well, I tried for a while but I couldn't get it to happen again.

Thinking back over my Spanish campaign:

If I remember right the two generals had the exact same name.

It was something like this-

Alfonso 1 [king]
--Rodrigo (son of Alfonso I) [heir]
----Alfonso 2 (son of Rodrigo)
--Alfonso 3 (son of Alfonso I)

Alfonso 1 died, and Rodrigo became king, Alfonso 2 became heir.

Then in the random clicking I swapped heir back and forth between Alfonso 2 & 3.

Anyway I'm disappointed that I couldn't repeat it, I didn't want to believe that it was a bug, but I guess it was.