Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Rotator Read fields never update after Engage (timer removed in dfb7b02)

未关闭 适合新手
#423 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
c, linux
领域
backend, desktop

调研方向

从 src/gtk-rot-ctrl.c 中的 gtk_rot_ctrl_new() 开始,然后检查 rot_ctrl_timeout_cb() 和 gtk_rot_ctrl_destroy(),以了解计时器的设置和清理。将 Cycle 值设为 10 来重现问题,并检查 Azimuth/Elevation Read 标签是否在 Engage 后更新;完成标准是它们能够刷新,同时现有的关闭窗口崩溃防护保持完好。

由索引模型根据 Issue 内容生成。

描述

bug

Alex,

While testing the most recent version in the repo, I encountered a loss of connectivity to my HamLi controlled, LVB Tracker mediated Yaesu G-5500 az/el rotor controller. This has also been an intermittent issue for me before but I could not understand why. The that end, I used the Claude LLM to help troubleshoot the problem. A summary of what was reported back, and a solution that is now working for me is below.

Best,
Bob
N6RFM

Summary

gtk_rot_ctrl_new() no longer starts the rotator widget's own periodic
display-refresh timer. As a result, the Azimuth/Elevation "Read:"
labels in the Rotator Control window can remain permanently stuck at
--- after clicking Engage, even though the underlying rotctld
connection and hardware communication are completely healthy.

Whether this is visible depends on an unrelated setting (the Cycle
spinbox's saved value), which makes it intermittent and hard to
pin down from user reports alone.

Environment

  • Reproduced on current master (9399b12, "Fix spelling error")
    and on every tagged release from 2.4 through 2.6.4
  • GTK 3.24.41, GLib 2.80.0, built from source on Ubuntu 24.04
  • Also reproduced in a headless sandbox using Hamlib's "Dummy"
    rotator backend, so it is not specific to any particular rotator
    hardware or rotctld model

Steps to reproduce

  1. Configure any rotator device (Preferences → Interfaces → Rotators)
    with rotctld connection details.
  2. Ensure the rotator's saved Cycle value in its .rot config file
    is exactly 10 (see "Root cause" below for why this specific
    value matters).
  3. Open a module's Rotator Control window and click Engage.

Expected: The Azimuth/Elevation "Read:" fields update
periodically with the rotator's actual reported position.

Actual: The fields remain at --- indefinitely. The Engage
button correctly toggles to "Disengage," rotctld logs successful
position queries, and a manual rotctl -m 2 -r <host>:<port> p query
returns correct live values — but the GUI never reflects it.

Disengaging and re-engaging, restarting rotctld, or rebuilding from
a clean checkout does not change the outcome.

Root cause

Commit dfb7b02276a9f2887be5de62a32e36c79c128637 ("Closing the rotor
control window while a rotor is engaged no longer crashes Gpredict")
fixed a real double-free/crash-on-close bug, but in doing so removed
the only unconditional call that created the widget's periodic
refresh timer:

--- a/src/gtk-rot-ctrl.c
+++ b/src/gtk-rot-ctrl.c
@@ -1681,9 +1681,6 @@ GtkWidget      *gtk_rot_ctrl_new(GtkSatModule * module)
     gtk_box_pack_start(GTK_BOX(rot_ctrl), table, FALSE, FALSE, 5);
     gtk_container_set_border_width(GTK_CONTAINER(rot_ctrl), 5);

-    rot_ctrl->timerid = g_timeout_add(rot_ctrl->delay,
-                                      rot_ctrl_timeout_cb, rot_ctrl);
-
     if (module->target > 0)
         gtk_rot_ctrl_select_sat(rot_ctrl, module->target);

The satellite module's own periodic loop still calls
gtk_rot_ctrl_update() on the widget every cycle, but this alone is
not sufficient to drive the display — confirmed by explicitly
wiring module->rotctrl to a test-instrumented widget (matching the
production code path in gtk-sat-module-popup.c's rotctrl_cb
exactly) and still observing the labels never update. Without
rot_ctrl->timerid being set at creation, the widget's own refresh
cycle is simply never established.

Why it's intermittent rather than always broken

A separate, unrelated handler happens to recreate the same timer as
a side effect:

static void delay_changed_cb(GtkSpinButton * spin, gpointer data)
{
    GtkRotCtrl *ctrl = GTK_ROT_CTRL(data);
    ctrl->delay = (guint) gtk_spin_button_get_value(spin);
    if (ctrl->conf)
        ctrl->conf->cycle = ctrl->delay;
    if (ctrl->timerid > 0)
        g_source_remove(ctrl->timerid);
    ctrl->timerid = g_timeout_add(ctrl->delay, rot_ctrl_timeout_cb, ctrl);
}

This fires on the Cycle spinbox's "value-changed" signal, which
GTK also emits when the value is set programmatically — as
happens automatically at startup when a saved rotator device is
auto-selected via rot_selected_cb():

gtk_spin_button_set_value(GTK_SPIN_BUTTON(ctrl->cycle_spin), ctrl->conf->cycle);

The Cycle spinbox is constructed with
gtk_spin_button_new_with_range(10, 10000, 10), so its value is 10
before any config is applied. GTK only fires "value-changed" when
the new value differs from the current one — so:

Saved Cycle Signal fires? Timer created? Display works?
10 No No Stuck at ---
Anything else Yes Yes Works

DEFAULT_CYCLE_MS (1000) is used whenever a .rot file has no
Cycle key at all — the normal case for a rotor configured fresh
through Preferences, since that dialog doesn't expose a Cycle field.
So the bug mostly surfaces for users who have, at some point, set
the live Cycle field to exactly its minimum value (e.g. chasing the
fastest possible update rate), or copied/adapted a .rot file from
elsewhere with that value already present.

How this was isolated

Manual testing on real GS-232-protocol hardware confirmed rotctld
and the serial link were always healthy, which ruled out everything
except the GUI code itself. To pin down the exact commit, a headless,
fully automated reproduction was built:

  • Xvfb virtual display + Hamlib's built-in Dummy rotator backend
    (no physical hardware required)
  • A small instrumentation hook that creates the Rotator Control
    widget, engages it programmatically, waits, then reads the
    AzRead/ElRead label text directly and reports pass/fail — no
    GUI clicking or screenshots
  • git bisect run against this script between a confirmed-good
    commit and current master

This identified dfb7b02 as the exact point where behavior changed,
and follow-up tests confirmed the Cycle-value mechanism specifically
(rather than just the commit boundary) — including confirming that
toggling Engage/Disengage, which is a natural first troubleshooting
step, cannot fix it, since that code path never touches the timer.

Suggested fix

Restore the timer creation, keeping the ctrl->timerid = 0 reset in
gtk_rot_ctrl_destroy() (added in b74d9bdf9fcfc27d7ea606d779a8f6d6f33a6cb7,
the commit immediately after dfb7b02) as the existing guard against
the original double-free:

rot_ctrl->timerid = g_timeout_add(rot_ctrl->delay,
                                  rot_ctrl_timeout_cb, rot_ctrl);

Verified in the sandboxed reproduction above: with this line restored,
the Read fields update correctly even with Cycle set to 10 — the
exact value that leaves current master permanently broken.

Happy to open a PR with this change if useful.

主要语言
C
星标
1.2k
派生
305
平均合并
8 小时 48 分钟
30 天内合并 PR
3

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

csete/gpredict 的其他 Issue

查看 csete/gpredict 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。