Linux & Windows: Fix for Preferences crash caused by lazy-loading QtMultimedia (#1545)
Linux & Windows: Fix for Preferences crash caused by lazy-loading QtMultimedia (#1545)

* Qt: Fixup for the preferenes dialog crash

The crash was only happening when scanning the QR cameras. If the camera
scan code was removed, the crash would stop happening.

I suspect that QtMultimedia doesn't like to be invoked from a button
clicked handler or an action handler, or while constructing the dialog,
or both.

So the fix is to do the camera scan from the top-level event loop via a
QueuedConnection.

We fire off a signal on showEvent of the preferences dialog, which is
connected via QueuedConnection to a handler that then imports
QtMultimedia and then does all population of the video device combobox.

This fix makes it so that I can no longer reproduce the crash.

The ultimate root of the problem likely is some but in PyQt5, as it does
not happen with PySide2.

* Linux: Fixups

QtMultimedia lazy-loading was still crashing on Linux intermittently.

The only fix was to load QtMultimedia at app startup, rather
than lazy-load it from within the Preferences dialog.

This fixes the crashes on both Windows and Linux.

* Minor nit

* Nit: Make sure the QueuedConnection slot can't execute after dlg close

fyookball/electrum,fyookball/electrum,fyookball/electrum