Fix memory leak in system
This commit is contained in:
parent
55e21737dd
commit
b1cddb4600
@ -32,8 +32,8 @@ QString ScreenshotDialog::message() const
|
|||||||
|
|
||||||
QList<ScreenShot *> ScreenshotDialog::selected() const
|
QList<ScreenShot *> ScreenshotDialog::selected() const
|
||||||
{
|
{
|
||||||
QList<ScreenShot *> list;
|
QList<std::shared_ptr<ScreenShot>> list;
|
||||||
QList<ScreenShot *> first = m_list->screenshots();
|
QList<std::shared_ptr<ScreenShot>> first = m_list->screenshots();
|
||||||
for (QModelIndex index : ui->listView->selectionModel()->selectedRows())
|
for (QModelIndex index : ui->listView->selectionModel()->selectedRows())
|
||||||
{
|
{
|
||||||
list.append(first.at(index.row()));
|
list.append(first.at(index.row()));
|
||||||
@ -51,7 +51,7 @@ void ScreenshotDialog::on_uploadBtn_clicked()
|
|||||||
}
|
}
|
||||||
SequentialTask *task = new SequentialTask(this);
|
SequentialTask *task = new SequentialTask(this);
|
||||||
NetJob *job = new NetJob("Screenshot Upload");
|
NetJob *job = new NetJob("Screenshot Upload");
|
||||||
for (ScreenShot *shot : m_uploaded)
|
for (std::shared_ptr<ScreenShot> shot : m_uploaded)
|
||||||
{
|
{
|
||||||
job->addNetAction(ImgurUpload::make(shot));
|
job->addNetAction(ImgurUpload::make(shot));
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
QString message() const;
|
QString message() const;
|
||||||
QList<ScreenShot *> selected() const;
|
QList<std::shared_ptr<ScreenShot>> selected() const;
|
||||||
|
|
||||||
private
|
private
|
||||||
slots:
|
slots:
|
||||||
@ -35,6 +35,6 @@ slots:
|
|||||||
private:
|
private:
|
||||||
Ui::ScreenshotDialog *ui;
|
Ui::ScreenshotDialog *ui;
|
||||||
ScreenshotList *m_list;
|
ScreenshotList *m_list;
|
||||||
QList<ScreenShot *> m_uploaded;
|
QList<std::shared_ptr<ScreenShot>> m_uploaded;
|
||||||
std::shared_ptr<ImgurAlbumCreation> m_imgurAlbum;
|
std::shared_ptr<ImgurAlbumCreation> m_imgurAlbum;
|
||||||
};
|
};
|
||||||
|
@ -88,10 +88,10 @@ void ScreenshotList::deleteSelected(ScreenshotDialog *dialog)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
QList<ScreenShot *>::const_iterator it;
|
QList<std::shared_ptr<ScreenShot>>::const_iterator it;
|
||||||
for (it = screens.cbegin(); it != screens.cend(); it++)
|
for (it = screens.cbegin(); it != screens.cend(); it++)
|
||||||
{
|
{
|
||||||
ScreenShot *shot = *it;
|
std::shared_ptr<ScreenShot> = *it;
|
||||||
if (!QFile(shot->file).remove())
|
if (!QFile(shot->file).remove())
|
||||||
{
|
{
|
||||||
CustomMessageBox::selectable(dialog, tr("Error!"),
|
CustomMessageBox::selectable(dialog, tr("Error!"),
|
||||||
|
Loading…
Reference in New Issue
Block a user