mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Fix memory leaks from DeckLoader usage (#5665)
* add comment * stack allocate DeckLoader for loading tags * deckModel now takes ownership of DeckLoader * fix remaining * add comment
This commit is contained in:
parent
87c5d07807
commit
e1964f21de
7 changed files with 33 additions and 8 deletions
|
|
@ -128,6 +128,10 @@ void AbstractTabDeckEditor::actSwapCard(CardInfoPtr info, QString zoneName)
|
|||
deckDockWidget->deckModel->findCard(info->getName(), zoneName, providerId, collectorNumber));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the currently active deck for this tab
|
||||
* @param _deck The deck. Takes ownership of the object
|
||||
*/
|
||||
void AbstractTabDeckEditor::setDeck(DeckLoader *_deck)
|
||||
{
|
||||
deckDockWidget->setDeck(_deck);
|
||||
|
|
@ -289,12 +293,13 @@ void AbstractTabDeckEditor::openDeckFromFile(const QString &fileName, DeckOpenLo
|
|||
SettingsCache::instance().recents().updateRecentlyOpenedDeckPaths(fileName);
|
||||
if (deckOpenLocation == NEW_TAB) {
|
||||
emit openDeckEditor(l);
|
||||
l->deleteLater();
|
||||
} else {
|
||||
deckMenu->setSaveStatus(false);
|
||||
setDeck(l);
|
||||
}
|
||||
} else {
|
||||
delete l;
|
||||
l->deleteLater();
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not open deck at %1").arg(fileName));
|
||||
}
|
||||
deckMenu->setSaveStatus(true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue