mirror of
https://github.com/quickshell-mirror/quickshell.git
synced 2026-10-27 02:54:36 +00:00
wayland/screencopy: avoid crash when capturing null screen
Prevent null pointer dereference in IccOutputSourceManager, WlrScreencopyManager, and ScreencopyManager when captureSource references a null screen.
This commit is contained in:
1 parent
18c95fae4a
commit
95a1f91125
4 files changed
+6
No files matched your search
@@ -4,3 +4,4 @@
|
||||
- Fixed Hyprland workspaces keeping their old id after Hyprland changes it.
|
||||
- Fixed desktop entries being parsed incorrectly with trailing whitespace or CRLF line endings.
|
||||
- Fixed `WlSessionLock.locked` changes not being emitted on unlock.
|
||||
- Fixed a crash when unplugging a screen being captured by ScreencopyView or trying to capture the fallback screen.
|
||||
@@ -220,6 +220,8 @@ IccOutputSourceManager* IccOutputSourceManager::instance() {
|
||||
}
|
||||
|
||||
ScreencopyContext* IccOutputSourceManager::captureOutput(QScreen* screen, bool paintCursors) {
|
||||
if (screen == nullptr) return nullptr;
|
||||
|
||||
auto* waylandScreen = dynamic_cast<QtWaylandClient::QWaylandScreen*>(screen->handle());
|
||||
if (!waylandScreen) return nullptr;
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ namespace qs::wayland::screencopy {
|
||||
|
||||
ScreencopyContext* ScreencopyManager::createContext(QObject* object, bool paintCursors) {
|
||||
if (auto* screen = qobject_cast<QuickshellScreenInfo*>(object)) {
|
||||
if (screen->screen == nullptr) return nullptr;
|
||||
|
||||
#if SCREENCOPY_ICC
|
||||
{
|
||||
auto* manager = icc::IccOutputSourceManager::instance();
|
||||
|
||||
@@ -34,6 +34,7 @@ WlrScreencopyManager* WlrScreencopyManager::instance() {
|
||||
|
||||
ScreencopyContext*
|
||||
WlrScreencopyManager::captureOutput(QScreen* screen, bool paintCursors, QRect region) {
|
||||
if (screen == nullptr) return nullptr;
|
||||
if (!dynamic_cast<QtWaylandClient::QWaylandScreen*>(screen->handle())) return nullptr;
|
||||
return new WlrScreencopyContext(this, screen, paintCursors, region);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user