Skip to content

Commit 5a52bdf

Browse files
docs: SG-43585: record why macOS keeps the software Qt Quick backend
The QT_QUICK_BACKEND comments no longer described reality. Both files still explained the setting as a Qt 5.12.1 workaround for QWebEngineView conflicting with the QGLWidget viewport, which has not been the reason since the viewport became a native QOpenGLWindow. src/bin/apps/rv/main.cpp (Windows, Linux): drop the block outright. The call was already commented out, so all that remained was a commented-out line plus a rationale for a decision the code no longer makes. Linux has since confirmed the setting is not needed there -- it launches and runs docked web panels without it. src/bin/nsapps/RV/main.cpp (macOS): the setting stays, and the comment now says why, because it is load bearing rather than vestigial. The viewport window is embedded with QWidget::createWindowContainer, making it a QObject child of the top level window's QWidgetWindow. With the hardware Qt Quick backend, adding a QWebEngineView makes Qt destroy and recreate that native subtree; the viewport window is deleted with it rather than reparented, and QWindowContainer then dereferences the window it just lost, so RV segfaults inside Qt. Measured on macOS with the four line reproducer now quoted in the comment: software backend survives 2/2, hardware backend crashes 2/2. The cost is that macOS web panels composite in software, so macOS gets the cheap viewport repaint half of this work but not the hardware web panel half. Noted in the comment so the asymmetry with Windows and Linux reads as deliberate. Comment-only; no compiled behaviour changes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Bernard Laberge <bernard.laberge@autodesk.com>
1 parent 80b2e64 commit 5a52bdf

2 files changed

Lines changed: 28 additions & 15 deletions

File tree

src/bin/apps/rv/main.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -353,18 +353,6 @@ int utf8Main(int argc, char* argv[])
353353

354354
TwkFB::ThreadPool::initialize();
355355

356-
// Qt 5.12.1 specific
357-
// Disable Qt Quick hardware rendering because QwebEngineView conflicts with
358-
// QGLWidget
359-
//
360-
// Direction C: the RV viewport is now a native GL window (GLWindow) hosted
361-
// via createWindowContainer, not a QOpenGLWidget. The main window no longer
362-
// forces the OpenGL RHI backend, so QtWebEngine's QQuickWidget can composite
363-
// on the platform default backend at hardware speed. The old software Qt
364-
// Quick workaround (which caused the ~77 ms per-frame web-view composite) is
365-
// therefore no longer needed.
366-
// setEnvVar("QT_QUICK_BACKEND", "software");
367-
368356
#if defined(PLATFORM_LINUX)
369357
// Work around for Wacom Tablet issue on linux
370358
// Note: This is a Qt 5.12.4 regression

src/bin/nsapps/RV/main.cpp

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,34 @@ int main(int argc, char* argv[])
284284

285285
setPlatformSpecificLocale();
286286

287-
// Qt 5.12.1 specific
288-
// Disable Qt Quick hardware rendering because QwebEngineView conflicts with
289-
// QGLWidget
287+
//
288+
// Keep Qt Quick on the software backend. Do not remove this on macOS.
289+
//
290+
// It was originally added because QWebEngineView conflicted with the
291+
// QGLWidget viewport, and src/bin/apps/rv/main.cpp has since dropped it for
292+
// Windows and Linux -- but on macOS it is now load bearing for a different
293+
// reason. The viewport is a native QOpenGLWindow embedded via
294+
// QWidget::createWindowContainer, which makes it a QObject child of the top
295+
// level window's QWidgetWindow. With the hardware Qt Quick backend, adding a
296+
// QWebEngineView to the widget tree makes Qt destroy and recreate that
297+
// native subtree; the viewport window is deleted with it rather than
298+
// reparented, and QWindowContainer then dereferences the window it just
299+
// lost. RV segfaults inside Qt, before it can react.
300+
//
301+
// Reproducible in four lines from any docked panel -- with the software
302+
// backend this survives, with the hardware backend it crashes:
303+
//
304+
// w = rv.qtutils.sessionWindow()
305+
// d = QtWidgets.QDockWidget('t', w)
306+
// v = QtWebEngineWidgets.QWebEngineView(d)
307+
// d.setWidget(v); w.addDockWidget(QtCore.Qt.RightDockWidgetArea, d)
308+
// v.setHtml('<b>hi</b>')
309+
//
310+
// The cost of keeping it is that web panels composite in software on macOS,
311+
// so macOS gets the cheap-viewport-repaint half of SG-43585 but not the
312+
// hardware web panel half. Removing it needs the viewport to stop being
313+
// owned by the top level window's native subtree, not just a comment change.
314+
//
290315
setenv("QT_QUICK_BACKEND", "software", 0 /* changeFlag : Do not change the existing value */);
291316

292317
// Prevent usage of native sibling widgets on Mac. This attribute can be

0 commit comments

Comments
 (0)