fixed memory leak in mainwindow.cpp