Menu

#157 Waypoint Properties dialog shows wrong waypoint symbol

v1.9
closed-fixed
nobody
None
5
2021-03-21
2020-08-17
lbayuk
No

Using: Viking 1.8 on Linux (32 bit)

Under some conditions, the Properties dialog for an existing waypoint will show the wrong waypoint symbol. Opening the properties dialog then clicking OK without changes will result in the waypoint symbol changing.

Reproduce steps:

  1. Start Viking with no file.
  2. Add a TrackWaypoint layer and select it.
  3. Add a waypoint (001) with a Red Flag symbol, accepting the other defaults.
  4. Add 2 more waypoints (002 and 003), accepting all defaults.
    You now have 3 waypoints with Red Flag symbols.
  5. Expand the TrackWaypoint layer and Waypoints sub-layer in the sidebar.
  6. Right-click > Properties on waypoint 002 and change the symbol to Blue Flag and OK.
  7. Right-click > Properties on waypoint 003.
    Note that the dialog shows the waypoint symbol as Blue Flag, even though the current symbol for that waypoint is Red Flag. If you click OK without changing the dialog, the waypoint symbol changes to Blue Flag.

If you switch the symbols - red and blue - and repeat, the bug does not appear. Explanation below.

  1. Start Viking with no file.
  2. Add a TrackWaypoint layer and select it.
  3. Add a waypoint (001) with a Blue Flag symbol, accepting the other defaults.
  4. Add 2 more waypoints (002 and 003), accepting all defaults.
    You now have 3 waypoints with Blue Flag symbols.
  5. Expand the TrackWaypoint layer and Waypoints sub-layer in the sidebar.
  6. Right-click > Properties on waypoint 002 and change the symbol to Red Flag and OK.
  7. Right-click > Properties on waypoint 003.
    Note that in this case the dialog correctly shows the current waypoint symbol, Blue Flag.

Here is what I think is going on. Viking remembers the last used waypoint symbol, for use with new waypoints. When the properties dialog opens for an existing waypoint, Viking is supposed to show its current symbol. But it searches for a match on either "last used symbol" or "current symbol" in the list of valid symbols, and whichever matches first is used. Blue Flag is earlier in the list than Red Flag. So if "last used" happens to be Blue Flag, that gets incorrectly picked for a waypoint which has Red Flag as its current symbol.

I think the bug is in src/viktrwlayer_wpwin.c, function a_dialog_waypoint(), line 243:

if (sym && (!g_strcmp0(sym, wp->symbol) || !g_strcmp0(sym, last_sym))) {

It accepts a match with either current symbol, or last used symbol. I think maybe it should only accept a match with current symbol for existing waypoints, and with last used symbol for new waypoints.

Discussion

  • Rob Norris

    Rob Norris - 2020-08-17

    Thanks for reporting this.

    Agreed, it is a bit of logic failure in combining the tests in the single pass of available icons.

    Needs to be separate checks as you suggest.

     
  • lbayuk

    lbayuk - 2020-08-29

    Here's a 1-line patch I tested and am now using with viking-1.8.

     
    👍
    1
  • Rob Norris

    Rob Norris - 2020-09-10
    • status: open --> pending-fixed
    • Group: v1.7 --> v1.9
     
  • Rob Norris

    Rob Norris - 2020-09-10

    Patch applied to the mainline code base

     
  • Rob Norris

    Rob Norris - 2021-03-21
    • status: pending-fixed --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB