Fix crash on first launch: initialize m_pLogView - #33
Merged
ghirpara merged 1 commit intoAug 14, 2026
Conversation
DzScriptServerPane's constructor calls appendLog() for each message from
AuthenticationService::loadOrGenerateToken, which happens ~180 lines before
m_pLogView is assigned in the UI setup. m_pLogView was the only widget
pointer missing from the initializer list, so appendLog()'s
if (!m_pLogView) return;
guard tested an uninitialized value, passed on non-zero stack garbage, and
dereferenced it.
loadOrGenerateToken only emits messages when there is no valid token file,
so this reproduces exactly once per machine -- on the very first launch,
before any token exists. The crashing run still writes the token first
(saveToken precedes the message), so the bug disarms itself and a relaunch
succeeds, which is why it is easy to miss. It is also invisible wherever the
uninitialized value happens to be zero.
Observed on DAZ Studio 6 (Qt 6.10.3, Windows 11) with the v2.8.0 DS6 build:
ACCESS_VIOLATION at QTextEdit::append()+21, three frames of
dsp_DazScriptServer-ds6-windows.dll beneath it, with Studio's log ending at
"Creating Pane Manager...".
Member
|
@abrady Merged. Good catch! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DzScriptServerPane::m_pLogViewis never initialized before the constructor callsappendLog(), so the first launch on a machine with no token file dereferences an uninitialized pointer and takes DAZ Studio down during startup.Crash
Studio's log ends at
Creating Pane Manager..., and the stack has threedsp_DazScriptServer-ds6-windows.dllframes directly beneathQTextEdit::append.Environment: DAZ Studio 6 beta, stock Qt 6.10.3.0,
Qt6Core5Compat.dllpresent, Windows 11, prebuiltdsp_DazScriptServer-ds6-windows.dllfrom release v2.8.0. Not an ABI mismatch — that Qt matches theaqt install-qt windows desktop 6.10.3 win64_msvc2022_64pin inbuild-windows.yml.Cause
m_pLogView(include/DzScriptServerPane.h:310) is the only widget pointer missing from the constructor's initializer list —m_pServer,m_pAsyncMgr,m_pCleanupTimer,m_pEventBrokerandm_pPersistentScriptare all there.The constructor calls
appendLog()atsrc/DzScriptServerPane.cpp:240, roughly 180 lines beforem_pLogView = new QTextEdit(this)at line 424. The guard inappendLog:tests an indeterminate value, passes on non-zero stack garbage, and line 783 dereferences it.
Why it reproduces only once
AuthenticationService::loadOrGenerateTokenpopulatesoutMessagesonly when there is no valid token file — with one, it early-returns with the list empty, the loop never runs, andappendLogis never reached. (On Windows the permissions-warning branch is#ifndef _WIN32, so a valid token means zero messages.)The crashing run still writes the token first, since
saveTokenprecedes the message that kills it — so the bug disarms itself and relaunching just works. A maintainer who already has a token cannot reproduce it, and it is invisible wherever the garbage happens to be zero.Workaround for anyone hitting this: create
~/.daz3d/dazscriptserver_token.txtcontaining any ≥32-character line before first launch.Fix
One line, placed to match declaration order (
m_pEventClientsLabelis line 309,m_pLogViewline 310).Worth a follow-up audit: the other widget pointers (
m_pStartBtn,m_pStopBtn,m_pAutoStartCheck, …) are uninitialized on the same path. They aren't dereferenced this early today, so this PR leaves them alone.Testing
Reproduced the crash on a clean machine, applied the workaround to confirm the token-file dependency, and verified the plugin then loads and runs normally —
Running on 127.0.0.1:18811 (Protected), with scene queries, morph reads, visibility toggles and async renders all working against DS6.