Return-Path: X-Original-To: apmail-pivot-user-archive@www.apache.org Delivered-To: apmail-pivot-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A051343EA for ; Mon, 9 May 2011 11:51:34 +0000 (UTC) Received: (qmail 86105 invoked by uid 500); 9 May 2011 11:51:34 -0000 Delivered-To: apmail-pivot-user-archive@pivot.apache.org Received: (qmail 86084 invoked by uid 500); 9 May 2011 11:51:34 -0000 Mailing-List: contact user-help@pivot.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@pivot.apache.org Delivered-To: mailing list user@pivot.apache.org Received: (qmail 86076 invoked by uid 99); 9 May 2011 11:51:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 May 2011 11:51:34 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [195.159.29.9] (HELO mailstore05.sysedata.no) (195.159.29.9) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 May 2011 11:51:26 +0000 Received: from [195.159.98.68] (helo=[10.0.1.184]) by mailstore05.sysedata.no with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1QJOzQ-0002r7-Kv for user@pivot.apache.org; Mon, 09 May 2011 13:51:04 +0200 Message-ID: <4DC7D530.4030606@sysedata.no> Date: Mon, 09 May 2011 13:51:12 +0200 From: Edvin Syse User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; nb-NO; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: user@pivot.apache.org Subject: Re: ConcurrentModificationException in layout process References: <4DC54BF2.7010504@sysedata.no> <4DC57C5E.6010008@sysedata.no> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit That makes sense :) Is it as expected that trying to manipulate the UI on a non-UI thread sometimes yields an error and other times not? -- Edvin Den 09.05.2011 13:45, skrev Greg Brown: > Using a Task is not a problem, but when you call back into the UI you need to wrap it in a TaskAdapter. Tasks are executed on a background thread but all UI calls need to happen on the main thread. > > On May 7, 2011, at 1:07 PM, Edvin Syse wrote: > >> If I pass --autologin=true to my app, there will be kicked off a Task with a TaskListener right away. Basically the flow is like this: >> >> 1. The application class loads a bxml file representing a Frame. >> 2. If --auto-login=true, call the login() method in the Frame >> 3. The login() method creates a task and a tasklistener, that would close the Frame and load another one on successful login. >> >> The first step is performed like this: >> >> LoginFrame loginFrame = (LoginFrame) serializer.readObject(VortexApplication.class, "LoginFrame.bxml"); >> loginFrame.open(display, null); >> >> if ("true".equals(properties.get("autologin"))) >> loginFrame.login(); >> >> loginFrame.login() is basically: >> >> Task task = new Task() { >> ... >> } >> >> TaskListener loggedInListener = new TaskListener() { >> public void taskExecuted(Task task) { >> MainWindow mainWindow = (MainWindow) serializer.readObject(MainWindow.class, "MainWindow.bxml"); >> mainWindow.open(display); >> close(); >> ... >> >> Not a good idea? :) >> >> -- Edvin >> >> >> >> Den 07.05.2011 18:00, skrev Greg Brown: >>> Are you using background threads in your application by any chance? >>> >>> On May 7, 2011, at 9:41 AM, Edvin Syse wrote: >>> >>>> Once in a while I will get the following exception when I start my application. It appears maybe once every 30th start of the application. Since it is indeterministic I thought I'd post it here. I could create a test-case for this, but it could take some time to reproduce. Here goes: >>>> >>>> Exception in thread "AWT-EventQueue-0" java.util.ConcurrentModificationException >>>> at org.apache.pivot.collections.ArrayList$ArrayListItemIterator.hasNext(ArrayList.java:50) >>>> at org.apache.pivot.util.ImmutableIterator.hasNext(ImmutableIterator.java:37) >>>> at org.apache.pivot.wtk.skin.DisplaySkin.layout(DisplaySkin.java:49) >>>> at org.apache.pivot.wtk.Component.layout(Component.java:1951) >>>> at org.apache.pivot.wtk.Container.layout(Container.java:340) >>>> at org.apache.pivot.wtk.Component.validate(Component.java:1942) >>>> at org.apache.pivot.wtk.ApplicationContext$QueuedCallback.run(ApplicationContext.java:1488) >>>> at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) >>>> at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:641) >>>> at java.awt.EventQueue.access$000(EventQueue.java:84) >>>> at java.awt.EventQueue$1.run(EventQueue.java:602) >>>> at java.awt.EventQueue$1.run(EventQueue.java:600) >>>> at java.security.AccessController.doPrivileged(Native Method) >>>> at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87) >>>> at java.awt.EventQueue.dispatchEvent(EventQueue.java:611) >>>> at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) >>>> at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) >>>> at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) >>>> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) >>>> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) >>>> at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) >>>> >>>> -- Edvin