Use shared_ptr to store dialogs to allow proper deletion