There is no need to store a list of pointers to the MDI subwindows; this functionality is already provided by QMdiArea::subWindowList
.
Regarding the other problem, I suggest setting the attribute WA_DeleteOnClose
for the subwindows (subWindow->setAttribute(WA_DeleteOnClose);
) which will ensure that the subwindow's destructor is called when it is closed. If that doesn't solve the problem, I suggest creating a separate question for that.