Skip to content

FE/Qt: Do not wildcard-disconnect the synthetic work-area workers - #844

Open
dr1fter wants to merge 1 commit into
VirtualBox:mainfrom
dr1fter:397-watchdog-typed-disconnect
Open

FE/Qt: Do not wildcard-disconnect the synthetic work-area workers#844
dr1fter wants to merge 1 commit into
VirtualBox:mainfrom
dr1fter:397-watchdog-typed-disconnect

Conversation

@dr1fter

@dr1fter dr1fter commented Aug 30, 2026

Copy link
Copy Markdown

Fixes #397. Likely also covers #658 and #633, which are the same crash reached
by a shell restart or screen lock changing the host work area.

Problem

r173930 / 700da74 introduced this teardown for the UIInvisibleWindow helpers
that measure host-screen available geometry:

pWorker->disconnect();
pWorker->deleteLater();

The no-argument disconnect() is a wildcard: it also removes Qt's internal
destroyed() connections. Qt warns about exactly this:

QObject::disconnect: wildcard call disconnects from destroyed signal of
UIInvisibleWindow::unnamed

With that bookkeeping gone, any host work-area change can crash the frontend
while the replacement worker is being created:

QAccessibleWidget::text(QAccessible::Text) const
QWidgetPrivate::setWindowTitle_sys(QString const&)
QWidgetPrivate::setWindowModified_helper()
QWidgetPrivate::create()
QWidget::showMaximized()
UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized(QRect const&)
QGuiApplicationPrivate::processScreenGeometryChange(...)

Notably this needs no monitor hotplug, suspend/resume or DPMS transition. On
X11 an ordinary _NET_WORKAREA change is enough — toggling a desktop panel's
autohide reproduces it on the first attempt, which is why reports involving
shell restarts (#658) and screen locks (#633) look unrelated but are not.

QT_ACCESSIBILITY=0 is sometimes suggested as a workaround; it has no effect
on Qt 6, where the AT-SPI bridge is brought up over D-Bus regardless.

Change

Disconnect only the signal actually connected here —
UIInvisibleWindow::sigHostScreenAvailableGeometryCalculated — at all three
worker-lifecycle sites (sltHandleHostScreenAvailableGeometryCalculated,
updateHostScreenAvailableGeometry, cleanupExistingWorkers), keeping the
deleteLater() from r173930.

Validation

Arch Linux, X11, Cinnamon 6.6.9/Muffin 6.6.3, VirtualBox 7.2.16, Qt 6.11.2.
Trigger: toggling panel autohide, moving _NET_WORKAREA between 1170 and 1200.

stock patched
forced work-area cycles crash on cycle 1 6 cycles, no crash
new coredumps 2 0
wildcard-disconnect warning present absent

Note on the wider design

The deeper issue is that the work-area handler itself calls
updateHostScreenAvailableGeometry(), which creates a real window and
maximises it — so measuring the work area perturbs the work area. This change
makes that survivable; a re-entrancy guard in
sltHandleHostScreenWorkAreaResized() would address the shape of it more
directly. I kept to the smaller change because it is the one I could verify.

r173930 introduced 'pWorker->disconnect(); pWorker->deleteLater();' for the
UIInvisibleWindow helpers used to measure host-screen available geometry. The
no-argument disconnect() is a wildcard and also removes Qt's internal
destroyed() connections, which Qt warns about:

  QObject::disconnect: wildcard call disconnects from destroyed signal of
  UIInvisibleWindow::unnamed

With that bookkeeping gone, any host work-area change can crash the frontend
while the replacement worker is being created:

  QAccessibleWidget::text()
   <- QWidgetPrivate::setWindowTitle_sys()
   <- QWidgetPrivate::create()
   <- QWidget::showMaximized()
   <- UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized()

No monitor hotplug, suspend/resume or DPMS transition is needed; on X11 an
ordinary _NET_WORKAREA change (a desktop panel hiding, or the shell being
restarted) is sufficient and reproduces on the first attempt.

Disconnect only the worker signal actually connected here, at all three
worker-lifecycle sites, keeping the deleteLater() from r173930.

Tested on 7.2.16 with Qt 6.11.2 on X11: stock crashes on the first forced
work-area change, patched survives repeated cycles with no new coredumps and
no wildcard-disconnect warning.

Fixes: VirtualBox#397
Signed-off-by: Christian Cwienk <ccwienk@dr1fter.de>
@oracle-contributor-agreement

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
The following contributors of this PR have not signed the OCA:

To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.

When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.

If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public.

@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. label Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Required At least one contributor does not have an approved Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Segfault when turning screen off and on

1 participant