UnderwaterApps / overlap2d

Overlap2D Game development toolkit for UI and Level design
Other
781 stars 224 forks source link

Error in cleaning duplicates of project history #260

Open azakhary opened 9 years ago

azakhary commented 9 years ago

java.lang.IndexOutOfBoundsException: Index: 8, Size: 7 at java.util.ArrayList.rangeCheck(Unknown Source) at java.util.ArrayList.remove(Unknown Source) at com.uwsoft.editor.data.manager.PreferencesManager.cleanDuplicates(Pre ferencesManager.java:124) at com.uwsoft.editor.data.manager.PreferencesManager.storeRecentHistory( PreferencesManager.java:102) at com.uwsoft.editor.data.manager.PreferencesManager.popHistory(Preferen cesManager.java:138) at com.uwsoft.editor.data.manager.PreferencesManager.pushHistory(Prefere ncesManager.java:130) at com.uwsoft.editor.view.menu.Overlap2DMenuBarMediator.recentProjectIte mClicked(Overlap2DMenuBarMediator.java:244) at com.uwsoft.editor.view.menu.Overlap2DMenuBarMediator.handleFileMenuNo tification(Overlap2DMenuBarMediator.java:157) at com.uwsoft.editor.view.menu.Overlap2DMenuBarMediator.handleNotificati on(Overlap2DMenuBarMediator.java:100) at com.puremvc.core.CoreView$$Lambda$21/858176064.onNotification(Unknown Source) at com.puremvc.patterns.observer.BaseObserver.notifyObserver(BaseObserve r.java:82) at com.puremvc.core.CoreView.notifyObservers(CoreView.java:128) at com.puremvc.patterns.facade.SimpleFacade.notifyObservers(SimpleFacade .java:361) at com.puremvc.patterns.facade.SimpleFacade.sendNotification(SimpleFacad e.java:323) at com.uwsoft.editor.event.MenuItemListener.changed(MenuItemListener.jav a:44) at com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.handle(ChangeLis tener.java:28) at com.badlogic.gdx.scenes.scene2d.Actor.notify(Actor.java:181) at com.badlogic.gdx.scenes.scene2d.Actor.fire(Actor.java:146) at com.badlogic.gdx.scenes.scene2d.ui.Button.setChecked(Button.java:123)

    at com.badlogic.gdx.scenes.scene2d.ui.Button$1.clicked(Button.java:91)
    at com.badlogic.gdx.scenes.scene2d.utils.ClickListener.touchUp(ClickList

ener.java:89) at com.badlogic.gdx.scenes.scene2d.InputListener.handle(InputListener.ja va:58) at com.badlogic.gdx.scenes.scene2d.Stage.touchUp(Stage.java:348) at com.badlogic.gdx.InputMultiplexer.touchUp(InputMultiplexer.java:96) at com.badlogic.gdx.backends.lwjgl.LwjglInput.processEvents(LwjglInput.j ava:306) at com.badlogic.gdx.backends.lwjgl.LwjglCanvas$3.run(LwjglCanvas.java:23 4) at java.awt.event.InvocationEvent.dispatch(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$1.doIntersectionPrivilege(Unknown Sour ce) 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) Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: No OpenGL con text found in the current thread. at org.lwjgl.opengl.GLContext.getCapabilities(GLContext.java:124) at org.lwjgl.opengl.GL11.glDeleteTextures(GL11.java:732) at com.badlogic.gdx.backends.lwjgl.LwjglGL20.glDeleteTexture(LwjglGL20.j ava:248) at com.badlogic.gdx.graphics.GLTexture.delete(GLTexture.java:170) at com.badlogic.gdx.graphics.Texture.dispose(Texture.java:194) at com.badlogic.gdx.graphics.g2d.TextureAtlas.dispose(TextureAtlas.java: 418) at com.badlogic.gdx.scenes.scene2d.ui.Skin.dispose(Skin.java:389) at com.kotcrab.vis.ui.VisUI.dispose(VisUI.java:65) at com.uwsoft.editor.Overlap2D.dispose(Overlap2D.java:92) at com.badlogic.gdx.backends.lwjgl.LwjglCanvas$4.run(LwjglCanvas.java:30 9) at java.awt.event.InvocationEvent.dispatch(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$1.doIntersectionPrivilege(Unknown Sour ce) 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)

dsaltares commented 8 years ago

I doubt this can cause a crash. Is this callstack still relevant?

azakhary commented 8 years ago

Yes this is still relevant. When storing path of recently opened project that path can come through 2 different sources, and this sources usually have differently put slashes in them while being the same path. When first fixing this issue, I tried the obvious of - making sure path slashes are consistant, but then it just happened so that it will require a lot of change, so I thought this "ugly patch" is a better temporary solution. But then this crash happened. This part is a bit of a mess.

dsaltares commented 8 years ago

Right, but I was wondering how ArrayList.remove() can crash with an OutOfBoundsException. Is there anything here happening concurrently?

azakhary commented 8 years ago

This was caused by clicking on a recent menu item (judging from trace) . Should be nothing happening concurrently here. But I did not write "PreferencesManager.java" itself, so I am not sure maybe it's doing something like that, I would look there first

azakhary commented 8 years ago

Here it happens twice in a row though, recentProjectItemClicked->push history then it immediately does openProjectFromPath which in turn openProjectAndLoadAllData which in turn does prefs.pushHistory(prjFilePath); So this is already bad, maybe no reason to do the first one if second one already happens?

And maybe something happened with preferences there, like not flushing or similar? It has to be related.

Still doesnot explain why it does not always happen, but only sometimes.