Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/core/treeland.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2023 Dingyuan Zhang <lxz@mkacg.com>.
// Copyright (C) 2023-2026 Dingyuan Zhang <lxz@mkacg.com>.
// SPDX-License-Identifier: Apache-2.0 OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#include "treeland.h"
Expand Down Expand Up @@ -314,7 +314,10 @@ Treeland::Treeland()
d->init();

auto globalSession = d->helper->sessionManager()->globalSession();
Q_ASSERT(globalSession);
if (!globalSession) {
qCCritical(lcTlCore) << "Global session is null, skipping initialization";
return;
}

if (CmdLine::ref().run().has_value()) {
auto exec = [runCmd = CmdLine::ref().run().value(), d, globalSession] {
Expand Down
11 changes: 8 additions & 3 deletions src/greeter/usermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ UserModel::UserModel(QObject *parent)

auto userList = d->manager.userList();
if (!userList) {
qFatal() << userList.error();
qCWarning(lcTlGreeter) << "Failed to get user list:" << userList.error();
return;
}

const auto uids = userList.value();
Expand Down Expand Up @@ -95,8 +96,12 @@ UserModel::UserModel(QObject *parent)
}

if (d->currentUserName.isEmpty()) {
qCWarning(lcTlGreeter) << "Couldn't find last user, using current running user as current user";
d->currentUserName = d->users.first()->userName();
if (d->users.isEmpty()) {
qCWarning(lcTlGreeter) << "No users found, currentUserName remains empty";
} else {
qCWarning(lcTlGreeter) << "Couldn't find last user, using current running user as current user";
d->currentUserName = d->users.first()->userName();
}
}
}

Expand Down
10 changes: 8 additions & 2 deletions src/session/session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@

#include <woutputrenderwindow.h>
#include <wsocket.h>
#include <wxwayland.h>

Check warning on line 18 in src/session/session.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <wxwayland.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#include <pwd.h>

Check warning on line 20 in src/session/session.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <pwd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <unistd.h>

Check warning on line 21 in src/session/session.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <unistd.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <xcb/randr.h>

Check warning on line 22 in src/session/session.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <xcb/randr.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#define _DEEPIN_NO_TITLEBAR "_DEEPIN_NO_TITLEBAR"

Expand Down Expand Up @@ -381,8 +382,13 @@
// Session does not exist, create new session with deleter
auto passwd = getpwnam(username.toLocal8Bit().data());
if (!passwd) {
qCWarning(lcTlCore) << "Failed to get passwd entry for user:" << username;
return nullptr;
qCWarning(lcTlCore) << "Failed to get passwd entry for user:" << username
<< ", falling back to current user uid";
passwd = getpwuid(getuid());
if (!passwd) {
qCCritical(lcTlCore) << "Failed to get passwd entry for current user";
return nullptr;
}
}
auto session = std::make_shared<Session>();
session->m_id = id;
Expand Down
Loading