mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
fix: 修复拔掉显示器任务栏崩溃的问题
拔掉主屏幕显示器后,如果设置了仅显示在主屏,那么任务栏会找不到显示的屏幕。导致空指针从而崩溃 Log: 修复拔掉显示器任务栏崩溃的问题 Task: https://pms.uniontech.com/zentao/task-view-61658.html Change-Id: Ic9d431fc7828039bec9600789a406bf1d8e8f15a
This commit is contained in:
parent
735c6f5a86
commit
5c30551353
@ -90,12 +90,26 @@ public:
|
|||||||
QMapIterator<Monitor *, MonitorInter *>it(m_monitorInfo);
|
QMapIterator<Monitor *, MonitorInter *>it(m_monitorInfo);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
it.next();
|
it.next();
|
||||||
// 仅显示在主屏的情况下,可用屏幕信息只提供主屏幕
|
// 仅显示在主屏的情况下,可用屏幕信息只提供主屏幕(m_primary有可能不是主屏幕的名字,数据还没来得及切换过来)
|
||||||
if ((!m_showInPrimary && it.key()->enable())
|
// 问题场景:连接双屏,设置任务栏仅显示在主屏(gsettings),然后拔掉主屏幕显示器,任务栏崩溃
|
||||||
|| (m_showInPrimary && it.key()->name() == m_primary)) {
|
if (it.key()->enable()) {
|
||||||
list << it.key();
|
if (m_showInPrimary) {
|
||||||
|
if (it.key()->name() == m_primary) {
|
||||||
|
list.clear();
|
||||||
|
list.append(it.key());
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!list.isEmpty()) {
|
||||||
|
list.removeAt(0);
|
||||||
|
list.push_front(it.key());
|
||||||
|
} else
|
||||||
|
list << it.key();
|
||||||
|
} else
|
||||||
|
list << it.key();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user