Modify

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#22515 closed defect (fixed)

[Bug] Shortcuts for search string icons on toolbar made with Seach tool are not working

Reported by: Patrik_B Owned by: team
Priority: normal Milestone: 22.12
Component: Core shortcuts Version: tested
Keywords: shortcut icon search string Cc:

Description (last modified by Patrik_B)

What steps will reproduce the problem?

  1. Add any search string into the toolbar as toolbar icon https://prnt.sc/JUUGrAtKe9ts
  2. Right click on the toolbar -> Edit shortcut https://prnt.sc/OmRYWz5ZxdXp
  3. Add shortcut in Preferences https://prnt.sc/GQ8-qrUq4_xn

What is the expected result?

Working custom shotcut.

What happens instead?

In the preferences it says that there is assigned shortcut but it doesn't work.

Please provide any additional information below. Attach a screenshot if possible.

I tried different keys and nothing worked. I am not the only person for who this is not working.

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2022-10-31 17:29:20 +0100 (Mon, 31 Oct 2022)
Revision:18583
Build-Date:2022-11-01 02:30:58
URL:https://josm.openstreetmap.de/svn/trunk

Identification: JOSM/1.5 (18583 en_GB) Windows 11 64-Bit
OS Build number: Windows 10 Home 2009 (22621)
Memory Usage: 282 MB / 4060 MB (139 MB allocated, but free)
Java version: 17.0.2+8-86, Oracle Corporation, OpenJDK 64-Bit Server VM
Look and Feel: com.sun.java.swing.plaf.windows.WindowsLookAndFeel
Screen: \Display0 1920×1080 (scaling 1.00×1.00) \Display1 1280×1024 (scaling 1.00×1.00)
Maximum Screen Size: 1920×1080
Best cursor sizes: 16×16→32×32, 32×32→32×32
System property file.encoding: Cp1250
System property sun.jnu.encoding: Cp1250
Locale info: en_GB
Numbers with default locale: 1234567890 -> 1234567890
VM arguments: [-Dsun.java2d.noddraw=true]
Dataset consistency test: No problems found

Plugins:
+ FastDraw (35978)
+ apache-commons (36003)
+ apache-http (35924)
+ buildings_tools (36011)
+ changeset-viewer (v0.0.6)
+ conflation (0.6.9)
+ ejml (35924)
+ geochat (35978)
+ imagery_offset_db (35978)
+ jna (36005)
+ jts (36004)
+ mapathoner_1.2.0 (1.2.0)
+ mapwithai (1665506803)
+ markseen (14)
+ measurement (35978)
+ pt_assistant (1ff2e15)
+ scripting (v0.2.7)
+ terracer (35978)
+ todo (30306)
+ utilsplugin2 (36011)

Map paint styles:
+ https://github.com/MissingMaps/josm_styles/archive/master.zip
+ https://github.com/osmlab/appledata/archive/josm_paint_inline_validation.zip
+ D:\Mapathon\special\moje\My_painting_style.css
- https://josm.openstreetmap.de/josmfile?page=Styles/MapWithAI&zip=1
- https://gitlab.com/peculiar-theater/mapcss/-/archive/main/mapcss-main.zip?path=tm-taskgrid

Validator rules:
+ D:\Mapathon\special\moje\My_validator_rules.validator.mapcss

Last errors/warnings:
- 00000.433 W: extended font config - overriding 'filename.Myanmar_Text=mmrtext.ttf' with 'MMRTEXT.TTF'
- 00000.435 W: extended font config - overriding 'filename.Mongolian_Baiti=monbaiti.ttf' with 'MONBAITI.TTF'
- 00001.467 W: Unable to request certificate of https://roottest-g3.pkioverheid.nl
- 00001.832 W: Unable to request certificate of https://roottest-g3.pkioverheid.nl
- 00011.807 E: Failed to locate image 'bus.png'
- 00012.432 E: Failed to locate image 'MapWithAI'

Attachments (0)

Change History (5)

comment:1 by Patrik_B, 2 years ago

Description: modified (diff)

comment:2 by taylor.smock, 2 years ago

Thanks for this bug report.

It looks like this functionality hasn't worked since at least r8800 (2015), but more likely never worked.

Anyway, it appears that the hashCode functionality for SearchSetting is not stable, and since that is used for the preference key for the shortcut, a shortcut is only usable for a single session (it cannot persist across JVM restarts -- a restart isn't required when setting the toolbar shortcuts according to my testing, but I suspect some other code would not update their shortcuts, so the restart dialog should probably stay for now, even if it isn't always necessary).

Also,

I tried different keys and nothing worked. I am not the only person for who this is not working.

Even if it is just you that is encountering a problem, please open a bug report.

This is going to be a "simple" fix, assuming nothing else has issues with the fix.

comment:3 by taylor.smock, 2 years ago

Resolution: fixed
Status: newclosed

In 18600/josm:

Fix #22515: Shortcuts for search string icons on toolbar made with Search tool are not working

This happens due to the hashCode implementation in Enum (final int hashCode), as
it uses the default Object#hashCode implementation. This is stable inside the same
JVM instance, but will usually not be the same after a JVM restart.

Since the hashCode is used to find the preference value, it must be stable across
JVM restarts. To fix this problem, we just use the code char from the mode.

comment:4 by taylor.smock, 2 years ago

Milestone: 22.11

comment:5 by taylor.smock, 2 years ago

Milestone: 22.1122.12

Milestone renamed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.