QT dialog c++ Crash on Close button
Hi I have added a push button to dialog and doing below: closeButton->OnClick().Connect(this, &myclass::OnCloseButtonClick); Close button click: if (p_dialog) { p_dialog->Close(); auto otherDialog = _other; delete p_dialog; p_dialog = nullptr; otherDialog ->Show(); } Above works fine. If I want to perform same action (close current and open other dialog after releasing memory from current dialog) to default close button , it crashes. Below code causes crash: p_dialog->OnAboutToClose().Connect(this, &myclass::OnDialogClose); //on dialog close if (p_dialog) { //p_dialog->Close(); auto otherDialog = _other; delete p_dialog; p_dialog = nullptr; otherDialog ->Show(); } both slots are same apart from the fact that close is commented. Any hint on why it is crashing?