Keep references to native dialogs so not destroyed prematurely (OSX
segfault).