fix: Gradia-like capture causes treeland crashed#827
fix: Gradia-like capture causes treeland crashed#827LFRon wants to merge 1 commit intolinuxdeepin:masterfrom
Conversation
|
Hi @LFRon. Thanks for your PR. I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
https://github.com/linuxdeepin/treeland/actions/runs/24324090261/job/71015816742?pr=827 看看这个ci的报错,应该是需要更新copyright的时间 |
…t to 2026
When using Gradia (or any screenshot tool via xdg-desktop-portal) to capture, there is no mask surface. `m_canvas` is only set in `componentComplete()` when `captureManager()->maskShellSurface()` and `captureManager()->maskSurfaceWrapper()` both exist. Without a mask, `m_canvas` remains `nullptr`. When the capture `finishSelect` signal fires, `doneSelection()` unconditionally dereferences `m_canvas->surfaceItem()`, causing a null pointer crash (`this=0x0`).
__Fix__: Added a null guard before accessing `m_canvas->surfaceItem()`:
```cpp
if (m_canvas && m_canvas->surfaceItem())
m_canvas->surfaceItem()->setSubsurfacesVisible(false);
```
大佬,我现在改成这样正确嘛( |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: LFRon, wineee The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |

When using Gradia (or any screenshot tool via xdg-desktop-portal) to capture, there is no mask surface.
m_canvasis only set incomponentComplete()whencaptureManager()->maskShellSurface()andcaptureManager()->maskSurfaceWrapper()both exist. Without a mask,m_canvasremainsnullptr. When the capturefinishSelectsignal fires,doneSelection()unconditionally dereferencesm_canvas->surfaceItem(), causing a null pointer crash (this=0x0).Fix: Added a null guard before accessing
m_canvas->surfaceItem():