Fyne UI refinements: window geometry persistence, Telemetry SNR, menu & chat window polish - #180
Conversation
The thread was made joinable for the runtime disable path, but ui_comm_shutdown still only set g_ui_ctx = NULL and ws_shutdown'd, leaving a joinable thread unjoined at teardown. Stop it via spec_run, join it, then shut down the websocket server so no post-teardown broadcasts race the running flag.
The Connect() deferred flush and SendCommand() log send were moved out from under mc.mu, but they are still unguarded blocking sends: if nothing drains LogCh (capacity 100) they park forever — the same class sendOrStop exists for on the client side. Capture quit := mc.quit under the lock, then select on LogCh and quit so a disconnect unblocks the send. SendCommand returns 'disconnected' if quit wins.
client.ConnectARQ used the TargetCallsign captured at TCP-connect time, so editing the Target Callsign field after connecting was ignored and the old value (e.g. 'DEST') was sent on the next ARQ connect. Add Client.ConnectARQWith(src, dst) that passes explicit callsigns to the modem (ConnectARQ delegates to it with the stored config), and have the chat window read the entry fields at click time and pass them in.
…r tooltip - The Broadcast message button is now disabled during an ARQ session. - A hover tooltip explains why: it is shown via an invisible hover-catcher overlay stacked on the button, because widget.Button itself implements desktop.Hoverable and would otherwise shadow a plain wrapper when disabled. - setTCP/setARQ route the button through the hoverTooltipButton wrapper. - Rename the 'IP' config label to 'IP/Host'.
- New Infos menu after Settings with three items:
- Version: shows the engine release version + git commit hash in a
dialog, read via a new mercury_ui_get_version CGo bridge call
(MERCURY_VERSION / GIT_HASH).
- Support Us: opens the PayPal sponsorship link.
- Join our mailing list: opens the hermes-general subscribe page.
- engineLink.Version() (plus cString helper) and a stub for non-embedded
builds.
ShowAtRelativePosition resolves the canvas via CanvasForObject, which returned nil for the button nested inside the wrapper's Stack, so NewPopUp got a nil canvas and Show() segfaulted. Pass the window canvas directly to the wrapper, forward the mouse absolute position from the hover catcher, and position the popup with ShowAtPosition instead of ShowAtRelativePosition.
…sed on waterfall state
|
Reviewed and gated locally: C build clean, Two findings, one worth fixing before merge. 1.
|
The teardown join ran unlocked while ui_comm_set_waterfall()'s disable path joins the same thread under cfg_mutex. A waterfall toggle that had already read g_ui_ctx could reach its join concurrently with teardown, producing two pthread_join calls on one tid (undefined behaviour). Take cfg_mutex around the stop/join so both joiners agree on who zeroes spec_tid.
The old comment claimed mercury_bridge.c was compiled alongside the Go files by CGo. It is not: the libmercury_core.a rule compiles it with the engine CFLAGS (including -DGIT_HASH) and CGo only links the archive. Correct the comment so the git hash reported by mercury_ui_get_version is not misattributed to the #cgo CFLAGS.
8eabc93 — ui_comm_shutdown: join the spectrum thread under cfg_mutex (the double-join race fix).
I dug into this and the diagnosis doesn't hold for the actual build:
I verified empirically by compiling So in any The actual root cause of the confusion was a stale comment in If you'd instead prefer belt-and-suspenders (guarantee the hash even if someone builds outside |
|
You're right on the GIT_HASH point and I was wrong — thanks for digging in rather than just applying it. I verified your account end to end rather than take it on trust, and it holds:
The mutex fix in 8eabc93 is exactly right, including holding the lock across the Re-gated at 60ec265: C build clean, LGTM from me — both of my points are resolved, one by a fix and one by being wrong. |
Summary
A set of refinements for the Mercury Fyne UI, plus two engine-side robustness fixes.
UI (fyne-ui)
waterfallSNRColor.CanvasForObject.Engine robustness
modem: guard log-flush sends against a stalled consumer.ui_communication: stop and join the spectrum publisher thread on shutdown.Notes
xpos/yposfields (Fyne's publicWindowAPI has no position getter);RequestPositionis used to restore it.