Commit d2372a8c authored by Michael Lang's avatar Michael Lang Committed by Albert Astals Cid
Browse files

Fix ace auto move crash

Ace foundation auto moves were crashing after the game type was changed. Now removing PatPile before removing Pile during game type change.

BUG: 436181
parent b5ca2391
......@@ -598,6 +598,16 @@ void DealerScene::removePatPile( PatPile * pile )
}
void DealerScene::clearPatPiles()
{
const auto patPiles = this->patPiles();
for (PatPile * p : patPiles) {
removePatPile( p );
removePile( p );
}
}
QList<PatPile*> DealerScene::patPiles() const
{
return m_patPiles;
......
......@@ -79,6 +79,7 @@ public:
void addPatPile( PatPile * pile );
void removePatPile( PatPile * pile );
void clearPatPiles();
QList<PatPile*> patPiles() const;
void setAutoDropEnabled( bool enabled );
......
......@@ -133,17 +133,6 @@ void Freecell::gameTypeChanged()
if ( allowedToStartNewGame() )
{
// remove existing piles
for ( int i = 0; i < m_reserves; ++i )
removePile(freecell[i]);
for ( int i = 0; i < (m_stacks + 6); ++i )
removePile(store[i]);
for ( int i = 0; i < 4 * (m_decks + 1); ++i )
removePile(target[i]);
if ( m_variation != options->currentItem() )
{
setOptions(options->currentItem());
......@@ -165,6 +154,9 @@ void Freecell::gameTypeChanged()
matchVariant();
}
// remove existing piles
clearPatPiles();
initialize();
relayoutScene();
startNew( gameNumber() );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment