This is causing crashes when the Ptr that was supplied to the AiAvoidDoor constructor goes out of scope. It should have been a MWWorld::Ptr mDoorPtr; instead.
Just noticed this while working on doors. I will add the fix to my next PR.