Permalink
Browse files

Fix infinite polling for usb devices after the "add to whitelist" dia…

…log 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.
  • Loading branch information...
amaiorano committed Oct 10, 2018
1 parent f8c679b commit 3dec84a91b00b50c3d07c0eb68238173bd11cdd1
Showing with 3 additions and 4 deletions.
  1. +3 −4 Source/Core/DolphinQt/Settings/WiiPane.cpp
@@ -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()

0 comments on commit 3dec84a

Please sign in to comment.