Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit cf6d43ac authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

Install message handler after QApplication

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 to prevent miscommunication.

CHANGELOG: Now also works when using qt5ct

BUG: 400906

Differential Revision: https://phabricator.kde.org/D17335
parent ee0070a6
......@@ -56,8 +56,6 @@ void msgHandler(QtMsgType type, const QMessageLogContext &context, const QString
int main(int argc, char *argv[])
{
qInstallMessageHandler(msgHandler);
// otherwise when logging out, session manager will ask the host to quit
// (it's a "regular X app" after all) and then the browser will complain
qunsetenv("SESSION_MANAGER");
......@@ -67,6 +65,8 @@ int main(int argc, char *argv[])
a.setQuitOnLastWindowClosed(false);
// applicationName etc will be set in Settings once the browser identifies to us
qInstallMessageHandler(msgHandler);
// NOTE if you add a new plugin here, make sure to adjust the
// "DEFAULT_EXTENSION_SETTINGS" in constants.js or else it won't
// even bother loading your shiny new plugin!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment