Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#13402 closed defect (fixed)

[Patch] Shift+P (make parallel ways copy) causes crash

Reported by: GerdP Owned by: team
Priority: normal Milestone: 16.08
Component: Core Version:
Keywords: template_report regression gsoc-core Cc: michael2402

Description

What steps will reproduce the problem?

  1. start JOSM
  2. press Strg+N for a new layer
  3. press Shift+P for "parallel ways"

What is the expected result?

Cursor should change to show the symbol for parallel ways

What happens instead?

Crash report

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

Problem was probably introduced with 10824.
The old code for addPreferenceChangeListener(PreferenceChangedListener listener)in Preferences.java used
addIfAbsent(listener);
the new codes uses ensureNotInList(listener); and complains when the listener was already added. No idea why this was changed.

URL:http://josm.openstreetmap.de/svn/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2016-08-21 03:15:12 +0200 (Sun, 21 Aug 2016)
Build-Date:2016-08-21 01:38:47
Revision:10865
Relative:URL: ^/trunk

Identification: JOSM/1.5 (10865 en) Windows 10 64-Bit
Memory Usage: 1671 MB / 5461 MB (1549 MB allocated, but free)
Java version: 1.8.0_102-b14, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM
VM arguments: [-XX:StartFlightRecording=name=MyRecording2,settings=d:\dbg\gerd.jfc, -XX:FlightRecorderOptions=defaultrecording=true,dumponexit=true,dumponexitpath=e:\ld\perf_20160821_144212.jfr, -Dsun.java2d.opengl=true]
Dataset consistency test: No problems found

Plugins:
+ apache-commons (32699)
+ buildings_tools (32796)
+ ejml (32680)
+ geotools (32813)
+ jts (32699)
+ o5m (32857)
+ opendata (32811)
+ pbf (32699)
+ poly (32699)
+ reverter (32796)
+ utilsplugin2 (32815)


=== REPORTED CRASH DATA ===
BugReportExceptionHandler#handleException:
No data collected.

Warning issued by: BugReportExceptionHandler#handleException

=== STACK TRACE ===
Thread: AWT-EventQueue-0 (22) of main
java.lang.IllegalArgumentException: Listener org.openstreetmap.josm.actions.mapmode.ParallelWayAction@3119e0b2 (instance of org.openstreetmap.josm.actions.mapmode.ParallelWayAction) was already registered.
	at org.openstreetmap.josm.tools.ListenerList.failAdd(ListenerList.java:108)
	at org.openstreetmap.josm.tools.ListenerList.ensureNotInList(ListenerList.java:102)
	at org.openstreetmap.josm.tools.ListenerList.addListener(ListenerList.java:95)
	at org.openstreetmap.josm.data.Preferences.addPreferenceChangeListener(Preferences.java:231)
	at org.openstreetmap.josm.actions.mapmode.MapMode.enterMode(MapMode.java:67)
	at org.openstreetmap.josm.actions.mapmode.ParallelWayAction.enterMode(ParallelWayAction.java:150)
	at org.openstreetmap.josm.gui.MapFrame.selectMapMode(MapFrame.java:453)
	at org.openstreetmap.josm.gui.MapFrame.selectMapMode(MapFrame.java:432)
	at org.openstreetmap.josm.actions.mapmode.MapMode.actionPerformed(MapMode.java:99)
	at javax.swing.SwingUtilities.notifyAction(Unknown Source)
	at javax.swing.JComponent.processKeyBinding(Unknown Source)
	at javax.swing.KeyboardManager.fireBinding(Unknown Source)
	at javax.swing.KeyboardManager.fireKeyboardAction(Unknown Source)
	at javax.swing.JComponent.processKeyBindingsForAllComponents(Unknown Source)
	at javax.swing.JComponent.processKeyBindings(Unknown Source)
	at javax.swing.JComponent.processKeyEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
	at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
	at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
	at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$500(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

Attachments (1)

patch-fix-13402.patch (23.9 KB) - added by michael2402 3 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 3 years ago by Don-vip

Cc: michael2402 added
Keywords: regression gsoc-core added
Milestone: 16.08

Changed 3 years ago by michael2402

Attachment: patch-fix-13402.patch added

comment:2 Changed 3 years ago by michael2402

Thanks for reporting. I changed that code to use preference objects. This makes preference handling much easier as you don't have to worry about listeners.

comment:3 Changed 3 years ago by michael2402

Summary: Shift+P (make parallel ways copy) causes crash[Patch] Shift+P (make parallel ways copy) causes crash

comment:4 Changed 3 years ago by Don-vip

Ticket #13407 has been marked as a duplicate of this ticket.

comment:5 Changed 3 years ago by Don-vip

Why is mask not used in Modifier?

comment:6 Changed 3 years ago by Don-vip

Resolution: fixed
Status: newclosed

In 10869/josm:

fix #13402 - Shift+P (make parallel ways copy) causes crash (patch by michael2402, modified) - regression - gsoc-core

comment:7 Changed 3 years ago by michael2402

Because I first thought of pulling the modifiers out to JOSMAction to JOSMAction cleaner but I did not want to change so much code. Sorry for that, I should have removed it...

(We can still do it later, we could make the modifiers configurable. This would e.g. solve the problem that ALT is used by some window managers)

comment:8 Changed 3 years ago by Don-vip

OK no problem, I have removed this part, but yes we can add it back later :)

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.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.