1
0
Fork 0
mirror of synced 2024-06-02 02:34:40 +12:00

GameDlcWidget: Fix crash when installing or uninstalling a DLC

When the user navigates to a different game info page, the dlc widgets
get deleted. Because the signal was connected to a lambda, the connection
wasn't severed upon deletion and once the DLC would finish downloading,
Rare would crash because the object with the piggyback signal was already
deleted. By using a dedicated slot to emit the signal we ensure that the
connction is severed at Qt object deletion
This commit is contained in:
loathingKernel 2023-05-29 02:53:14 +03:00
parent 3acf289280
commit 6b0bf9621d
No known key found for this signature in database
GPG key ID: CE0C72D0B53821FD

View file

@ -42,7 +42,11 @@ class InstalledGameDlcWidget(GameDlcWidget):
self.ui.action_button.clicked.connect(self.uninstall_dlc)
self.ui.action_button.setText(self.tr("Uninstall DLC"))
# lk: don't reference `self.rdlc` here because the object has been deleted
rdlc.signals.game.uninstalled.connect(lambda: self.uninstalled.emit(rdlc))
rdlc.signals.game.uninstalled.connect(self.__uninstalled)
@pyqtSlot()
def __uninstalled(self):
self.uninstalled.emit(self.rdlc)
def uninstall_dlc(self):
self.rdlc.uninstall()
@ -58,7 +62,11 @@ class AvailableGameDlcWidget(GameDlcWidget):
self.ui.action_button.clicked.connect(self.install_dlc)
self.ui.action_button.setText(self.tr("Install DLC"))
# lk: don't reference `self.rdlc` here because the object has been deleted
rdlc.signals.game.installed.connect(lambda: self.installed.emit(rdlc))
rdlc.signals.game.installed.connect(self.__installed)
@pyqtSlot()
def __installed(self):
self.installed.emit(self.rdlc)
def install_dlc(self):
if not self.rgame.is_installed: