mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
quicksettings: Add kscreen usage null checks
There are cases where the config is nullptr, ensure we're checking for this.
This commit is contained in:
parent
0545ee5e65
commit
0da9ca21f8
2 changed files with 12 additions and 0 deletions
|
|
@ -15,11 +15,18 @@ KScreenOSDUtil::KScreenOSDUtil(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
{
|
{
|
||||||
connect(KScreen::ConfigMonitor::instance(), &KScreen::ConfigMonitor::configurationChanged, this, [this]() {
|
connect(KScreen::ConfigMonitor::instance(), &KScreen::ConfigMonitor::configurationChanged, this, [this]() {
|
||||||
|
if (!m_config) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
setOutputs(m_config->outputs().size());
|
setOutputs(m_config->outputs().size());
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(new KScreen::GetConfigOperation(), &KScreen::GetConfigOperation::finished, this, [this](auto *op) {
|
connect(new KScreen::GetConfigOperation(), &KScreen::GetConfigOperation::finished, this, [this](auto *op) {
|
||||||
m_config = qobject_cast<KScreen::GetConfigOperation *>(op)->config();
|
m_config = qobject_cast<KScreen::GetConfigOperation *>(op)->config();
|
||||||
|
if (!m_config) {
|
||||||
|
qDebug() << "kscreenosdutil: Unable to obtain kscreen config";
|
||||||
|
return;
|
||||||
|
}
|
||||||
KScreen::ConfigMonitor::instance()->addConfig(m_config);
|
KScreen::ConfigMonitor::instance()->addConfig(m_config);
|
||||||
setOutputs(m_config->outputs().size());
|
setOutputs(m_config->outputs().size());
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,11 @@ ScreenRotationUtil::ScreenRotationUtil(QObject *parent)
|
||||||
|
|
||||||
connect(new KScreen::GetConfigOperation(), &KScreen::GetConfigOperation::finished, this, [this](auto *op) {
|
connect(new KScreen::GetConfigOperation(), &KScreen::GetConfigOperation::finished, this, [this](auto *op) {
|
||||||
m_config = qobject_cast<KScreen::GetConfigOperation *>(op)->config();
|
m_config = qobject_cast<KScreen::GetConfigOperation *>(op)->config();
|
||||||
|
if (!m_config) {
|
||||||
|
qDebug() << "screenrotationutil: Unable to obtain kscreen config";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
KScreen::ConfigMonitor::instance()->addConfig(m_config);
|
KScreen::ConfigMonitor::instance()->addConfig(m_config);
|
||||||
|
|
||||||
// update all screens with event connect
|
// update all screens with event connect
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue