Skip to content

Commit 7522be5

Browse files
committed
fix(helper): disconnect QProcess::finished signal when received
… and handle the undefiend behavior. We are going to exit anyway, so we must avoid receiving extra signals that may interfere while exiting, as those may as well originate from undefined behavior found in Qt Base… Signed-off-by: tsrk. <tsrk@tsrk.me>
1 parent 7052ba8 commit 7522be5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/helper/HelperApp.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,25 @@ namespace SDDM {
199199
}
200200

201201
void HelperApp::sessionFinished(int exitCode, QProcess::ExitStatus exitStatus) {
202+
disconnect(m_session, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, &HelperApp::sessionFinished);
202203
if (exitStatus == QProcess::NormalExit) {
203204
if (exitCode != 0) {
204205
qWarning("Session crashed (exit code %d).", exitCode);
205206
exit(Auth::HELPER_SESSION_ERROR);
206207
}
207208
else
208209
exit(Auth::HELPER_SUCCESS);
210+
return;
211+
}
212+
213+
// Crashing with 0 is impossible, since UNIX signals start at 1…
214+
// …unless we reached an undefined behavior.
215+
if (exitCode == 0) {
216+
qCritical() << "Qt reached an undefined behavior. This should be reported to Qt, but will be ignored for the time being.";
217+
exit(Auth::HELPER_SUCCESS);
218+
return;
209219
}
220+
210221
qWarning("Session crashed (killed by signal %d).", exitCode);
211222
exit(Auth::HELPER_SESSION_ERROR);
212223
}

0 commit comments

Comments
 (0)