Fix crash when buying or selling TGO units.

Updating the game destroys this window so we cannot continue with the
calls. It worked in my initial testing, so presumably it's partly
dependent on when the finalizers run.

Since the windows will be destroyed there's nothing for us to actually
update, so just remove that signal and the explicit close calls.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1344
This commit is contained in:
Dan Albert 2021-06-25 16:28:24 -07:00
parent 380d1d4f18
commit 4d0fb67c53

View File

@ -264,14 +264,10 @@ class QGroundObjectMenu(QDialog):
self.subwindow = QBuyGroupForGroundObjectDialog( self.subwindow = QBuyGroupForGroundObjectDialog(
self, self.ground_object, self.cp, self.game, self.total_value self, self.ground_object, self.cp, self.game, self.total_value
) )
self.subwindow.changed.connect(self.do_refresh_layout)
self.subwindow.show() self.subwindow.show()
class QBuyGroupForGroundObjectDialog(QDialog): class QBuyGroupForGroundObjectDialog(QDialog):
changed = QtCore.Signal()
def __init__( def __init__(
self, self,
parent, parent,
@ -436,9 +432,6 @@ class QBuyGroupForGroundObjectDialog(QDialog):
GameUpdateSignal.get_instance().updateGame(self.game) GameUpdateSignal.get_instance().updateGame(self.game)
self.changed.emit()
self.close()
def buySam(self): def buySam(self):
sam_generator = self.samCombo.itemData(self.samCombo.currentIndex()) sam_generator = self.samCombo.itemData(self.samCombo.currentIndex())
price = sam_generator.price - self.current_group_value price = sam_generator.price - self.current_group_value
@ -455,9 +448,6 @@ class QBuyGroupForGroundObjectDialog(QDialog):
GameUpdateSignal.get_instance().updateGame(self.game) GameUpdateSignal.get_instance().updateGame(self.game)
self.changed.emit()
self.close()
def buy_ewr(self): def buy_ewr(self):
ewr_generator = self.ewr_selector.itemData(self.ewr_selector.currentIndex()) ewr_generator = self.ewr_selector.itemData(self.ewr_selector.currentIndex())
price = ewr_generator.price() - self.current_group_value price = ewr_generator.price() - self.current_group_value
@ -473,9 +463,6 @@ class QBuyGroupForGroundObjectDialog(QDialog):
GameUpdateSignal.get_instance().updateGame(self.game) GameUpdateSignal.get_instance().updateGame(self.game)
self.changed.emit()
self.close()
def error_money(self): def error_money(self):
msg = QMessageBox() msg = QMessageBox()
msg.setIcon(QMessageBox.Information) msg.setIcon(QMessageBox.Information)