Fix infinite polling for usb devices after the "add to whitelist" dialog has been opened once

Problem is that USBDeviceAddToWhitelistDialog starts a timer once created to poll for devices every second. In Qt, closing a heap-allocated dialog doesn't delete it, so it keeps on polling. This fix is to allocate dialog on the stack, then use "exec" to run it modally without returning. Once closed, the stack instance will get destroyed, thus killing the timer.
This commit is contained in:
Antonio Maiorano 2018-10-09 22:02:59 -04:00
parent f8c679bab9
commit 3dec84a91b
1 changed files with 3 additions and 4 deletions

View File

@ -249,11 +249,10 @@ void WiiPane::ValidateSelectionState()
void WiiPane::OnUSBWhitelistAddButton()
{
USBDeviceAddToWhitelistDialog* usb_whitelist_dialog = new USBDeviceAddToWhitelistDialog(this);
connect(usb_whitelist_dialog, &USBDeviceAddToWhitelistDialog::accepted, this,
USBDeviceAddToWhitelistDialog usb_whitelist_dialog(this);
connect(&usb_whitelist_dialog, &USBDeviceAddToWhitelistDialog::accepted, this,
&WiiPane::PopulateUSBPassthroughListWidget);
usb_whitelist_dialog->setModal(true);
usb_whitelist_dialog->show();
usb_whitelist_dialog.exec();
}
void WiiPane::OnUSBWhitelistRemoveButton()