Repository navigation
Conversation
DockPanel::geometry() unconditionally dereferenced window(), which returns nullptr whenever the panel's QML root object has not been created yet (still loading/incubating) or failed to load entirely. When any QML error prevents the dock main.qml root from being created, DockPositioner::dockGeometry() -> QMetaProperty::read -> DockPanel::geometry() dereferences the null window and crashes the whole dde-shell process. Since dde-shell is session critical, any dock QML error becomes a crash loop with no desktop at all. Return an empty QRect with a warning instead, consistent with the existing null guards in setFrontendWindowRect()/moveXEmbedWindow(). Observed on UOS 25 with Qt 6.12, whose QML compiler promotes duplicate property assignments to fatal errors: "Property value set multiple times" -> "Create root failed: org.deepin.ds.dock" -> SIGSEGV loop in QWindow::geometry(). Signed-off-by: pengfeixx <[email protected]>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pengfeixx 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 |
Reviewer's GuideImplementationAdd a runtime null check to DockPanel::geometry() so an unavailable QML window returns an empty rectangle with a warning instead of crashing.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="panels/dock/dockpanel.cpp" line_range="261" />
<code_context>
QRect DockPanel::geometry()
{
Q_ASSERT(window());
+ if (!window()) {
+ // The QML root object may not exist yet, e.g. when the panel QML
</code_context>
<issue_to_address>
**Shell still aborts on missing window**
When `window()` is null in a build with assertions enabled, `Q_ASSERT(window())` aborts before `DockPanel::geometry()` reaches the null guard, so the shell terminates instead of returning an empty rectangle.
Move or remove `Q_ASSERT(window())` so the null guard runs before any assertion on `window()`.
Also at `panels/dock/dockpanel.cpp:262`.
</issue_to_address>
### Comment 2
<location path="panels/dock/dockpanel.cpp" line_range="267" />
<code_context>
+ // failed to load or has not finished incubation. Dereferencing a
+ // null window here crashes the whole shell (SEGV in QWindow::geometry,
+ // triggered from DockPositioner::dockGeometry() via QMetaProperty::read).
+ qCWarning(dockLog) << "DockPanel: window is not available, return empty geometry";
+ return QRect();
+ }
</code_context>
<issue_to_address>
**Repeated queries flood logs**
When the window stays null while timer-driven position updates keep querying geometry, each null-window query emits another warning, so timer-driven `DockPositioner` updates repeatedly fill the logs while the panel remains unavailable.
Rate-limit the warning or log it only once until the window becomes available.
</issue_to_address>| @@ -259,6 +259,14 @@ bool DockPanel::init() | |||
| QRect DockPanel::geometry() | |||
| { | |||
| Q_ASSERT(window()); | |||
There was a problem hiding this comment.
🟡 Medium · Shell still aborts on missing window
When window() is null in a build with assertions enabled, Q_ASSERT(window()) aborts before DockPanel::geometry() reaches the null guard, so the shell terminates instead of returning an empty rectangle.
Move or remove Q_ASSERT(window()) so the null guard runs before any assertion on window().
Also at panels/dock/dockpanel.cpp:262.
Prompt for AI agents
In `panels/dock/dockpanel.cpp` at line 261:
**Shell still aborts on missing window**
When `window()` is null in a build with assertions enabled, `Q_ASSERT(window())` aborts before `DockPanel::geometry()` reaches the null guard, so the shell terminates instead of returning an empty rectangle.
Move or remove `Q_ASSERT(window())` so the null guard runs before any assertion on `window()`.
Also at `panels/dock/dockpanel.cpp:262`.| // failed to load or has not finished incubation. Dereferencing a | ||
| // null window here crashes the whole shell (SEGV in QWindow::geometry, | ||
| // triggered from DockPositioner::dockGeometry() via QMetaProperty::read). | ||
| qCWarning(dockLog) << "DockPanel: window is not available, return empty geometry"; |
There was a problem hiding this comment.
🟡 Medium · Repeated queries flood logs
When the window stays null while timer-driven position updates keep querying geometry, each null-window query emits another warning, so timer-driven DockPositioner updates repeatedly fill the logs while the panel remains unavailable.
Rate-limit the warning or log it only once until the window becomes available.
Prompt for AI agents
In `panels/dock/dockpanel.cpp` at line 267:
**Repeated queries flood logs**
When the window stays null while timer-driven position updates keep querying geometry, each null-window query emits another warning, so timer-driven `DockPositioner` updates repeatedly fill the logs while the panel remains unavailable.
Rate-limit the warning or log it only once until the window becomes available.
|
Problem
DockPanel::geometry()dereferenceswindow()without a runtime null check:DPanel::window()isqobject_cast<QQuickWindow*>(rootObject), which returnsnullptrwhenever the panel's QML root object has not been created yet (still loading/incubating) or failed to load entirely.Once any QML error prevents the dock root object from being created, the following chain kills the whole shell:
Since
[email protected]is restarted by systemd after each crash, any dock QML error becomes a crash loop with no desktop at all.Real-world reproduction (UOS 25 with Qt 6.12, whose QML compiler promotes duplicate property assignments in an object declaration to fatal errors):
Crash dump analysis:
si_addr=0x8,rdi=0— classic nullthis+ field offset read.Solution
Return an empty
QRectwith aqCWarningwhen the window is not available, so a broken/slow-loading panel degrades gracefully instead of taking down the session. This is consistent with the existing null guards insetFrontendWindowRect()/moveXEmbedWindow()in the same file.Impact
DockPanel::geometry()Summary by Sourcery
Bug Fixes: