From ab36277ccff114f98babc3d11558a35efaa011a7 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 23 Jun 2023 19:43:21 +0300 Subject: [PATCH 12/12] Qt: Fix hud_message_box leak See osdn #48275 Signed-off-by: Marko Lindqvist --- client/gui-qt/citydlg.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/client/gui-qt/citydlg.cpp b/client/gui-qt/citydlg.cpp index f73b5d66b5..77198d44b0 100644 --- a/client/gui-qt/citydlg.cpp +++ b/client/gui-qt/citydlg.cpp @@ -617,24 +617,24 @@ void impr_item::wheelEvent(QWheelEvent *event) ****************************************************************************/ void impr_item::mouseDoubleClickEvent(QMouseEvent *event) { - hud_message_box *ask; - QString s; - char buf[256]; - int price; - const int impr_id = improvement_number(impr); - const int city_id = dlgcity->id; - if (!can_client_issue_orders()) { return; } if (event->button() == Qt::LeftButton) { - ask = new hud_message_box(city_dlg); - if (test_player_sell_building_now(client.conn.playing, dlgcity, + char buf[256]; + int price; + const int impr_id = improvement_number(impr); + const int city_id = dlgcity->id; + hud_message_box *ask; + + if (test_player_sell_building_now(client_player(), dlgcity, impr) != TR_SUCCESS) { return; } + ask = new hud_message_box(city_dlg); + price = impr_sell_gold(impr); fc_snprintf(buf, ARRAY_SIZE(buf), PL_("Sell %s for %d gold?", @@ -647,7 +647,7 @@ void impr_item::mouseDoubleClickEvent(QMouseEvent *event) connect(ask, &hud_message_box::accepted, [=]() { struct city *pcity = game_city_by_number(city_id); - if (!pcity) { + if (pcity == nullptr) { return; } city_sell_improvement(pcity, impr_id); -- 2.40.1