NOISSUE fix minor memory leaks

This commit is contained in:
Petr Mrázek 2016-08-19 09:04:58 +02:00
parent 67eca08b22
commit eb747e08b7
7 changed files with 12 additions and 8 deletions

View File

@ -33,6 +33,14 @@ MinecraftProfile::MinecraftProfile(ProfileStrategy *strategy)
clear();
}
MinecraftProfile::~MinecraftProfile()
{
if(m_strategy)
{
delete m_strategy;
}
}
void MinecraftProfile::setStrategy(ProfileStrategy* strategy)
{
Q_ASSERT(strategy != nullptr);

View File

@ -38,6 +38,7 @@ class MULTIMC_LOGIC_EXPORT MinecraftProfile : public QAbstractListModel
public:
explicit MinecraftProfile(ProfileStrategy *strategy);
virtual ~MinecraftProfile();
void setStrategy(ProfileStrategy * strategy);
ProfileStrategy *strategy();

View File

@ -46,13 +46,8 @@ InstanceWindow::InstanceWindow(InstancePtr instance, QWidget *parent)
// Add page container
{
auto mainLayout = new QVBoxLayout;
auto provider = std::make_shared<InstancePageProvider>(m_instance);
m_container = new PageContainer(provider, "console", this);
mainLayout->addWidget(m_container);
mainLayout->setSpacing(0);
mainLayout->setContentsMargins(0,0,0,0);
setLayout(mainLayout);
setCentralWidget(m_container);
}

View File

@ -436,7 +436,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow
view = new GroupView(ui->centralWidget);
view->setSelectionMode(QAbstractItemView::SingleSelection);
view->setItemDelegate(new ListViewDelegate());
// FIXME: leaks ListViewDelegate
view->setItemDelegate(new ListViewDelegate(this));
view->setFrameShape(QFrame::NoFrame);
// do not show ugly blue border on the mac
view->setAttribute(Qt::WA_MacShowFocusRect, false);

View File

@ -10,6 +10,7 @@ LogView::LogView(QWidget* parent) : QPlainTextEdit(parent)
LogView::~LogView()
{
delete m_defaultFormat;
}
void LogView::setWordWrap(bool wrapping)

View File

@ -126,7 +126,6 @@ void PageContainer::refresh()
void PageContainer::createUI()
{
m_pageStack = new QStackedLayout;
m_filter = new QLineEdit;
m_pageList = new PageView;
m_header = new QLabel();
m_iconHeader = new IconLabel(this, QIcon(), QSize(24, 24));

View File

@ -60,7 +60,6 @@ private:
QSortFilterProxyModel *m_proxyModel;
PageModel *m_model;
QStackedLayout *m_pageStack;
QLineEdit *m_filter;
QListView *m_pageList;
QLabel *m_header;
IconLabel *m_iconHeader;