Skip to content

Commit

Permalink
fix: [headless] disbale headless if SIGTERM
Browse files Browse the repository at this point in the history
It cause system blocked when shutdown/logout

Log: fix bug
  • Loading branch information
Johnson-zs committed Sep 18, 2023
1 parent cc87835 commit 2f7640f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/apps/dde-file-manager/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,11 @@ static bool pluginsLoad()

static void handleSIGTERM(int sig)
{
qCritical() << "break with !SIGTERM! " << sig;
qWarning() << "break with !SIGTERM! " << sig;

if (qApp) {
// Don't use headless if SIGTERM, cause system shutdown blocked
qApp->setProperty("SIGTERM", true);
qApp->quit();
}
}
Expand Down Expand Up @@ -317,7 +319,8 @@ int main(int argc, char *argv[])
DPF_NAMESPACE::LifeCycle::shutdownPlugins();

bool enableHeadless { DConfigManager::instance()->value(kDefaultCfgPath, "dfm.headless", false).toBool() };
if (enableHeadless && !SysInfoUtils::isOpenAsAdmin()) {
bool isSigterm { qApp->property("SIGTERM").toBool() };
if (!isSigterm && enableHeadless && !SysInfoUtils::isOpenAsAdmin()) {
a.closeServer();
QProcess::startDetached(QString("%1 -d").arg(QString(argv[0])));
}
Expand Down

0 comments on commit 2f7640f

Please sign in to comment.