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:
parent
f8c679bab9
commit
3dec84a91b
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue