Suppose I create a QMenuBar using "new" in c++, then I create a QMenu using "new".. I then use addMenu to add the qmenu to the qmenubar.. Then I go and "delete" the qmenubar instance.. Is the memory allocated to qmenu freed up then?

In my program did this above and then deleted the qmenubar and then when I tried to delete the qmenu instance, my program blew up.. But if I deleted the qmenu instance and then the qmenubar instance, everything worked fine..