Fix for addControl prematurely deleting control.

Adds ref before removing control from current parent, avoiding deletion of control.
Rearranged execution.