Skip to content

Commit

Permalink
fix: invalid configuration generated when deleting a network
Browse files Browse the repository at this point in the history
  • Loading branch information
lanthora committed May 6, 2024
1 parent d1932ee commit 5b6a823
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion candyitem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ CandyItem::CandyItem()
setSizeHint(QSize(0, 40));

candy = std::shared_ptr<void>(candy_client_create(), candy_client_release);
candy_client_set_address_update_callback(candy.get(), address_update_callback);
KeepAlive::instance().add(candy);
}

Expand Down Expand Up @@ -47,6 +48,5 @@ void CandyItem::update()
candy_client_set_localhost(candy.get(), toStdString(settings.value("localhost")).c_str());
settings.endGroup();

candy_client_set_address_update_callback(candy.get(), address_update_callback);
KeepAlive::instance().restart(candy);
}
8 changes: 5 additions & 3 deletions detailarea.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,13 @@ void DetailArea::remove()
{
removeButton->setEnabled(false);
int row = candyList->currentRow();
CandyItem *item = dynamic_cast<CandyItem *>(candyList->takeItem(row));
settings.remove(item->text());
settings.sync();
CandyItem *item = dynamic_cast<CandyItem *>(candyList->takeItem(row));
QString name = item->text();
delete item;

settings.remove(name);
settings.sync();

if (candyList->count() == 0) {
reset();
} else if (candyList->count() > row) {
Expand Down

0 comments on commit 5b6a823

Please sign in to comment.