mark the warning case in QSessionManager constructor as unlikely

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-09-28 02:22:58 +00:00
parent 5f4f6b6437
commit cbcedce2c5

View file

@ -3726,8 +3726,9 @@ QSessionManager::QSessionManager(QApplication * app, QString &id, QString& key)
cb.shutdown_cancelled.client_data = (SmPointer) d; cb.shutdown_cancelled.client_data = (SmPointer) d;
// avoid showing a warning message below // avoid showing a warning message below
if (qgetenv("SESSION_MANAGER").isEmpty()) if (qgetenv("SESSION_MANAGER").isEmpty()) {
return; return;
}
smcConnection = SmcOpenConnection(0, 0, 1, 0, smcConnection = SmcOpenConnection(0, 0, 1, 0,
SmcSaveYourselfProcMask | SmcSaveYourselfProcMask |
@ -3742,11 +3743,10 @@ QSessionManager::QSessionManager(QApplication * app, QString &id, QString& key)
id = QString::fromLatin1(myId); id = QString::fromLatin1(myId);
::free(myId); // it was allocated by C ::free(myId); // it was allocated by C
QString error = QString::fromLocal8Bit(cerror); if (Q_UNLIKELY(!smcConnection)) {
if (!smcConnection) { const QString error = QString::fromLocal8Bit(cerror);
qWarning("Qt: Session management error: %s", qPrintable(error)); qWarning("Qt: Session management error: %s", qPrintable(error));
} } else {
else {
sm_receiver = new QSmSocketReceiver(IceConnectionNumber(SmcGetIceConnection(smcConnection))); sm_receiver = new QSmSocketReceiver(IceConnectionNumber(SmcGetIceConnection(smcConnection)));
} }
} }