Install message handler after QApplication

Authored by broulik on Dec 3 2018, 4:06 PM.



When using qDebug et all we will use Connection::self()->sendMessage to forward that to the browser. Connection uses a QSocketNotifier to listen to browser commands. This requires a working event dispatcher.

When someone uses qDebug before QApplication initialized, e.g. qt5ct does this, our QSocketNotifier is defunct and we never receive any commands from the browser, breaking the extension.

While stdout is reserved for communcation with the browser, where any random debug output will have the browser shut us down, qDebug prints on stderr which can be used for printing debug output, so no file descriptors are closed.

BUG: 400906

Test Plan

Installed qt5ct, export QT_QPA_PLATFORMTHEME=qt5ct, both Chromium and Firefox now show working media controls

Diff Detail

R856 Plasma Browser Integration
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.Dec 3 2018, 4:06 PM
Restricted Application added a project: Plasma. · View Herald TranscriptDec 3 2018, 4:06 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik requested review of this revision.Dec 3 2018, 4:06 PM
davidedmundson accepted this revision.Dec 3 2018, 4:10 PM

Well found!

This revision is now accepted and ready to land.Dec 3 2018, 4:10 PM
This revision was automatically updated to reflect the committed changes.