代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/kiran-screensaver 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From d001fc82a1a872ae1dd0dadc5ef3d0c80181c1f6 Mon Sep 17 00:00:00 2001
From: liuxinhao <liuxinhao@kylinos.com.cn>
Date: Fri, 31 Dec 2021 15:32:01 +0800
Subject: [PATCH 2/3] fix(crash): fix crash in some situation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修复屏保后端在某些情况下崩溃的问题
---
src/idle-watcher/idle-watcher-mate.cpp | 3 +++
src/view/screen-manager.cpp | 16 ++++++++++------
src/view/screen-manager.h | 6 +++---
3 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/src/idle-watcher/idle-watcher-mate.cpp b/src/idle-watcher/idle-watcher-mate.cpp
index 0cba668..9d744c3 100644
--- a/src/idle-watcher/idle-watcher-mate.cpp
+++ b/src/idle-watcher/idle-watcher-mate.cpp
@@ -97,11 +97,14 @@ bool IdleWatcherMate::setIdleDetectionActive(bool idleDetectionActive)
m_idle = false;
m_idleNotice = false;
+
//NOTE:由于空闲预告阶段会抓取鼠标键盘到屏幕外,所以空闲预告阶段不会出现设置空闲检测的情况,暂时不需要考虑特殊情况
if(m_idleTimerID != 0)
{
killTimer(m_idleTimerID);
+ m_idleTimerID = 0;
}
+
m_idleDetectionActive = idleDetectionActive;
return true;
}
diff --git a/src/view/screen-manager.cpp b/src/view/screen-manager.cpp
index f8d7803..d7fc124 100644
--- a/src/view/screen-manager.cpp
+++ b/src/view/screen-manager.cpp
@@ -42,10 +42,10 @@ ScreenManager::ScreenManager(Fade *fade,
if (m_prefs != nullptr)
{
m_enableAnimation = m_prefs->getEnableAnimation();
- m_idleActivationLock = m_prefs->getIdleActivationLock();
+ //m_idleActivationLock = m_prefs->getIdleActivationLock();
}
- QCoreApplication::instance()->installEventFilter(this);
+ QApplication::instance()->installEventFilter(this);
}
ScreenManager::~ScreenManager()
@@ -260,14 +260,15 @@ bool ScreenManager::activate()
// 创建解锁框,屏保框
m_screensaver = new Screensaver(m_enableAnimation, nullptr);
- if (m_idleActivationLock)
- {
+ //NOTE:空闲是否锁定屏幕控制权交由IdleWatcher决定,若IdleWatcher发出空闲信号,则锁定屏幕
+// if (m_idleActivationLock) // 若开启空闲时锁定屏幕,创建解锁框
+// {
if (!setLockActive(true))
{
delete m_screensaver;
return false;
}
- }
+// }
// 获取桌面壁纸路径
QString backgroundPath;
@@ -371,9 +372,10 @@ bool ScreenManager::eventFilter(QObject *watched, QEvent *event)
return QObject::eventFilter(watched, event);
}
+//NOTE:在事件过滤之中删除某些控件并且该控件同时是事件的接收者需要过滤该事件,避免崩溃
bool ScreenManager::eventFilterActivate(QObject *watched, QEvent *event)
{
- if (!m_active)
+ if ( !m_active || (event->type()!=QEvent::MouseButtonPress && event->type()!=QEvent::KeyPress) )
return false;
// 若解锁框已被激活 按键和鼠标事件触发解锁框显示
@@ -388,6 +390,7 @@ bool ScreenManager::eventFilterActivate(QObject *watched, QEvent *event)
else if (!getLockActive())
{
emit sigReqDeactivated();
+ return true;
}
}
else if (event->type() == QEvent::KeyPress)
@@ -396,6 +399,7 @@ bool ScreenManager::eventFilterActivate(QObject *watched, QEvent *event)
if (!getLockActive())
{
emit sigReqDeactivated();
+ return true;
}
else
{
diff --git a/src/view/screen-manager.h b/src/view/screen-manager.h
index b5253a0..9fa14c9 100644
--- a/src/view/screen-manager.h
+++ b/src/view/screen-manager.h
@@ -121,10 +121,10 @@ private:
// 当前显示内容的背景窗口
Window* m_currentWindow = nullptr;
// 屏保界面
- Screensaver* m_screensaver;
+ Screensaver* m_screensaver = nullptr;
// 解锁框界面
- PluginInterface* m_lockerPluginInterface;
- LockerInterface* m_lockerInterface;
+ PluginInterface* m_lockerPluginInterface = nullptr;
+ LockerInterface* m_lockerInterface = nullptr;
};
} // namespace ScreenSaver
} // namespace Kiran
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。