I'm writing an application using QT that involves using the QMdiArea and consequently the creation of QMdiSubwindows.

Creating a sub window is fine, using QMdiArea::createSubWindow but when it comes to deleting them I have one question puzzling me.

My child windows are created automatically when a device is plugged into a USB port, and similarly the window is automatically closed should the device be detached from the USB port, and I do this with the QMdiArea::removeSubWindow(). I notice in the QT documentation that this function does not delete the QMdiSubWindow passed to it, and if I try

Qt Code:
  1. delete mdiSubWindow
To copy to clipboard, switch view to plain text mode 

The application crashes.. so just how am I supposed to delete it from memory, or have I misunderstood the documentation ?