Object mode locking wasn't accounting for the 3D view context which doesn't have an active object once its hidden.