Fix SIGSEGV on children destruction (frame and msgdlg)