Modify

Opened 15 years ago

Closed 15 years ago

#2775 closed defect (fixed)

[PATCH] Crash on gpx file

Reported by: marias@… Owned by: marias@…
Priority: major Milestone:
Component: Core Version: tested
Keywords: Cc:

Description

I was using the web-demo JOSM, loaded the first gpx file of this web http://www.topografix.com/gpx_sample_files.asp and was zoooming in and out when it crashed:

Path: trunk
URL: http://josm.openstreetmap.de/svn/trunk
Repository Root: http://josm.openstreetmap.de/svn
Repository UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Revision: 1669
Node Kind: directory
Last Changed Author: stoecker
Last Changed Rev: 1669
Last Changed Date: 2009-06-14 17:34:52 +0200 (Sun, 14 Jun 2009)

Java version: 1.5.0_17

java.lang.ClassCastException: java.lang.String

at org.openstreetmap.josm.gui.preferences.LanguagePreference$1.getListCellRendererComponent(LanguagePreference.java:49)
at org.openstreetmap.josm.gui.preferences.LanguagePreference$1.getListCellRendererComponent(LanguagePreference.java:50)
at javax.swing.plaf.basic.BasicComboBoxUI.getDisplaySize(BasicComboBoxUI.java:1182)
at javax.swing.plaf.metal.MetalComboBoxUI.getMinimumSize(MetalComboBoxUI.java:277)
at javax.swing.plaf.basic.BasicComboBoxUI.getPreferredSize(BasicComboBoxUI.java:855)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1624)
at java.awt.GridBagLayout.GetLayoutInfo(GridBagLayout.java:911)
at java.awt.GridBagLayout.getLayoutInfo(GridBagLayout.java:816)
at java.awt.GridBagLayout.preferredLayoutSize(GridBagLayout.java:636)
at java.awt.Container.preferredSize(Container.java:1558)
at java.awt.Container.getPreferredSize(Container.java:1543)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1626)
at javax.swing.ViewportLayout.preferredLayoutSize(ViewportLayout.java:78)
at java.awt.Container.preferredSize(Container.java:1558)
at java.awt.Container.getPreferredSize(Container.java:1543)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1626)
at javax.swing.ScrollPaneLayout.preferredLayoutSize(ScrollPaneLayout.java:475)
at java.awt.Container.preferredSize(Container.java:1558)
at java.awt.Container.getPreferredSize(Container.java:1543)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1626)
at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.calculateSize(BasicTabbedPaneUI.java:2085)
at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.preferredLayoutSize(BasicTabbedPaneUI.java:2059)
at java.awt.Container.preferredSize(Container.java:1558)
at java.awt.Container.getPreferredSize(Container.java:1543)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1626)
at java.awt.GridBagLayout.GetLayoutInfo(GridBagLayout.java:911)
at java.awt.GridBagLayout.getLayoutInfo(GridBagLayout.java:816)
at java.awt.GridBagLayout.ArrangeGrid(GridBagLayout.java:1412)
at java.awt.GridBagLayout.arrangeGrid(GridBagLayout.java:1372)
at java.awt.GridBagLayout.layoutContainer(GridBagLayout.java:712)
at java.awt.Container.layout(Container.java:1401)
at java.awt.Container.doLayout(Container.java:1390)
at java.awt.Container.validateTree(Container.java:1473)
at java.awt.Container.validateTree(Container.java:1480)
at java.awt.Container.validateTree(Container.java:1480)
at java.awt.Container.validateTree(Container.java:1480)
at java.awt.Container.validateTree(Container.java:1480)
at java.awt.Container.validateTree(Container.java:1480)
at java.awt.Container.validateTree(Container.java:1480)
at java.awt.Container.validateTree(Container.java:1480)
at java.awt.Container.validateTree(Container.java:1480)
at java.awt.Container.validateTree(Container.java:1480)
at java.awt.Container.validateTree(Container.java:1480)
at java.awt.Container.validate(Container.java:1448)
at java.awt.Window.dispatchEventImpl(Window.java:1789)
at java.awt.Component.dispatchEvent(Component.java:3819)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

Attachments (1)

plugindownload.patch (9.3 KB ) - added by jttt 15 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 by stoecker, 15 years ago

Owner: changed from team to marias@…
Status: newneedinfo

Hmm, that is very strange. That code only is called when the preferences dialog is opened. Are you sure you did not open prefs?

What OS do you use. What language? Was JOSM in English or in your language?

comment:2 by jttt, 15 years ago

Actually I'm able to reproduce it :-)

PreferenceAction creates preference dialog in a new thread (I've no idea why). If PreferenceAction is called twice in short time, something may go wrong.

If you call PreferenceAction in loop, all kind of exceptions will be thrown, including the one from this ticket. Marias probably pressed F12 by mistake, which caused the exception.

comment:3 by stoecker, 15 years ago

Well, I introduced the new thread because I found no other way to have a PleaseWait dialog in the plugin download.

We need a way to prevent double prefs calls then.

Any idea? I'm still not 100% sure about how to use Java threading. Evertime I choose to use it it works different to what I would expect from my experience with other languages.

comment:4 by jttt, 15 years ago

One of the rules is that almost all Swing related code should run in event dispatch thread because Swing is not thread safe. Running preference dialog in new thread does not respect this rule which may lead to strange results by itself.

I will have look at PleaseWait dialog to find out why it doesn't want to run without new thread. About PreferenceDialog - is there a reason why it can't be simply a modal dialog?

comment:5 by stoecker, 15 years ago

The reason was clear. The event queue handling was blocked :-)

About you question: Don't know.

comment:6 by jttt, 15 years ago

Attached patch contains following changes:

  • preferences dialog is modally called in EDT
  • PleaseWaitRunnable now can run in EDT
  • plugins are downloaded in EDT

I'm not really happy about running PleaseWaitRunnable in EDT because it's now easier to have two PleaseWaitRunnables running at the same time. Unfortunatelly I didn't find any other way.

Patch also fixes possible deadlock and more importantly memory leak in PleaseWaitRunnable. Event listeners were never removed from PleaseWaitDialog which caused all tasks to remain in memory.

by jttt, 15 years ago

Attachment: plugindownload.patch added

comment:7 by jttt, 15 years ago

Summary: Crash on gpx file[PATCH] Crash on gpx file

comment:8 by stoecker, 15 years ago

Resolution: fixed
Status: needinfoclosed

In r1733.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain marias@….
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.