Can you post how you embed the dialog in the view?
If you do so I can try to give you a solution. But I don't have the time to reinvent your code at all.

Where exactly did your application crash?...