If you allocated the QMainWindow on the stack (as is usually the case) then there is no heap allocated memory to delete and you have asked Qt to do exactly that.