Do I have to removeMouseListener before I delete component?

I am wondering if there is any negative side effects if I delete child components without removing the mouse listeners from the parent component first?

No, you don’t have to do it unless you’ve done something special with it before.

What do you mean by “something special”???

If you are 100% sure, that you are not inside a mouse event and that none of them occurs during your deletion, then you probably don’t.

  1. You should do it, if this deletion happens outside the MessageThread, because in that case a mouse callback could fire at any time. In doubt a MessageManagerLock could help, I think
  2. If the removal is scheduled inside a callback from that Component, that you are currently removing, you are obviously cutting the branch you are sitting on

This list might be incomplete…

For future people, please do! Read access violation on (MouseListener& l) in callChecked