Skip to content

Load client settings before --connect startup#3738

Open
seanogdelaney wants to merge 1 commit into
jamulussoftware:mainfrom
seanogdelaney:fix-startup-connect-no-gui
Open

Load client settings before --connect startup#3738
seanogdelaney wants to merge 1 commit into
jamulussoftware:mainfrom
seanogdelaney:fix-startup-connect-no-gui

Conversation

@seanogdelaney

@seanogdelaney seanogdelaney commented Jun 15, 2026

Copy link
Copy Markdown

Summary

  • prevent --connect from starting the client from the CClient constructor before INI-backed settings are loaded
  • remove the startup-address parameter from CClient so startup connection handling is owned by the post-settings startup paths
  • keep GUI startup connection handling in CClientDlg, where the dialog is created after Settings.Load() and Client.SetSettings()
  • start the client explicitly in the no-GUI path after settings have been loaded and attached to the client

This ensures startup connection negotiation uses the loaded client settings, including audio channel mode, so stereo-dependent UI/state such as pan controls is not initialized from constructor defaults.

CHANGELOG: Client: Ensure INI file settings are loaded before doing -c/--connect startup.

Testing

  • git diff --check
  • make -j2

Fixes #3732

Comment thread src/client.cpp Outdated
SetServerAddr ( strConnOnStartupAddress );
Start();
}
Q_UNUSED ( strConnOnStartupAddress );

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To do this properly, if the CClient constructor is indeed the wrong place to start the connection, strConnOnStartupAddress should be removed from the signature and invocation of CClient::CClient(), rather than just declaring it as unused.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 8d62998: removed strConnOnStartupAddress from the CClient constructor signature and the main.cpp invocation, and dropped the temporary Q_UNUSED. Also verified with git diff --check and make -j2.

Comment thread src/main.cpp
else
# endif
{
if ( !strConnOnStartupAddress.isEmpty() )

@softins softins Jun 15, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like the wrong place to insert this code. Originally, the -c option worked in both GUI and headless modes. Putting it at this location makes it only work in headless mode.

I think the best place to move it to would be up a few lines to just before the #ifndef HEADLESS around line 968. That is after the settings have been loaded, but before the GUI is loaded (if any).

Otherwise if that doesn't fix your issue, move it down a few lines to around line 1001, just before the end of the if ( bIsClient ) block.

@softins softins Jun 15, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, looks like you're correct here. I've only just noticed that CClientDlg handles the connect-at-startup when in GUI mode.

So disregard the above comment. But The CClient constructor still needs the other change.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - cleaned up that code.
Also clarified the PR summary.

@seanogdelaney seanogdelaney force-pushed the fix-startup-connect-no-gui branch from 4919b1a to 8d62998 Compare June 15, 2026 14:42
@seanogdelaney seanogdelaney changed the title Fix no-GUI startup connection timing Load client settings before --connect startup Jun 15, 2026
@seanogdelaney seanogdelaney force-pushed the fix-startup-connect-no-gui branch from 8d62998 to 7e8750c Compare June 15, 2026 15:48
@softins

softins commented Jun 15, 2026

Copy link
Copy Markdown
Member

@seanogdelaney thank you! I've built it and it tests out fine.

One remaining minor niggle is that the format check in the CI doesn't like the remaining blank line after Socket.Start() in client.cpp, as it leaves a blank line before the closing brace of a block.

If you have clang-format version 14 on your dev system, you can do make clang_format before committing, and it will fix any formatting anomalies to keep the CI happy.

@softins

softins commented Jun 15, 2026

Copy link
Copy Markdown
Member

Ah, you got there first!

@softins softins left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks, looks good to me now.

@seanogdelaney

Copy link
Copy Markdown
Author

Many thanks, looks good to me now.

Thanks Tony for the help. Let me know what to do next, if anything.

@softins softins requested a review from pljones June 15, 2026 16:52
@softins softins added this to the Release 4.0.0 milestone Jun 15, 2026
@softins softins added this to Tracking Jun 15, 2026
@github-project-automation github-project-automation Bot moved this to Triage in Tracking Jun 15, 2026
@softins softins moved this from Triage to Waiting on Team in Tracking Jun 15, 2026
@softins

softins commented Jun 15, 2026

Copy link
Copy Markdown
Member

Thanks Tony for the help. Let me know what to do next, if anything.

No problem. Nothing to do now, just wait for another team member to approve and merge. After that you can delete your branch.

@pljones

pljones commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Has this been tested without the GUI as well, just to make sure nothing unexpected happens? Is JSONRPC control of the connected client still possible, etc? Looks like it should just work, though.

@softins

softins commented Jun 15, 2026

Copy link
Copy Markdown
Member

Has this been tested without the GUI as well, just to make sure nothing unexpected happens?

Yes, I built it, and tested both with GUI and headless. It behaved as expected.

Is JSONRPC control of the connected client still possible, etc?

I didn't try the JSONRPC, which I always find rather fiddly. We could do with a JSONRPC controller application to make testing easier. Is there one? But I can't see anything in this change that would affect JSONRPC either way.

Looks like it should just work, though.

Agreed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Waiting on Team

Development

Successfully merging this pull request may close these issues.

--connect doesn't load ini before connecting, causing missing pan controls

3 participants