Cool bust of luck with the debugging session :-)

I went and checked and the developers guide[1] had this to say:
> Before you Start a word on Thread Safety
> Because this is a dynamic application we ask you not to hack away at these 
> data structures as the system is running (to do so often freezes the screen). 
> Instead we ask you to assemble acommand that will be issued in the user 
> interface thread.
> 
> uDig is highly threaded, as benefits a client application, ensuring that 
> "work" happens in the correct thread is a large benefit provided to you by 
> the GIS Application.
> 
> 

So let me know if we can make this warning appear in a more obvious location 
for the next developer :-)

Jody

[1] http://udig.refractions.net/confluence/display/DEV/02+Project+Map+and+Layer

On 22/09/2010, at 6:00 PM, Stanislas Nanchen wrote:

> Hi Jody, hi list,
> 
> Thanks for the answer. I indeed did not use a command to make this change.
> However the error still appears; debugging session ahead :)
> 
> stan
> 
> On 2010 Sep 21, at 22:33, Jody Garnett wrote:
> 
>> I think you have probably just found a bug; since I don't myself have the 
>> problem I will need to ask you to spend some time in the debugger to see 
>> what is going on and create a patch.
>> 
>> I am going to guess that the renderer is still trying to draw as the map is 
>> changed; we probably need to stop the renderer and then change the map?
>> 
>> I am going to just confirm that you are using a command to make this change 
>> (a command is like a small runnable that you pass to the map; it will run 
>> the command to update the internal state in a threadsafe manner; this is how 
>> we avoid changing the state of the map while the renderer or other code is 
>> making use of it).
>> 
>> Specifically calling any internal methods should be done only from inside a 
>> command.
>> 
>> Jody
>> 
>> On 21/09/2010, at 11:59 PM, Stanislas Nanchen wrote:
>> 
>>> Hello everyone,
>>> 
>>> At my company, we have embedded uDig for our map displaying purposes and I 
>>> have the following problem with the MapViewer 
>>> when setting a map for the second time via the method setMap.
>>> 
>>> In setMap, if an old map is present, its renderManager is kind of 
>>> 'disposed' with the following two lines of code:
>>> 
>>> (in MapViewer)
>>> 170         renderManager.setMapInternal( null );
>>> 171         renderManager.setMapDisplay(null);
>>> 
>>> In certain circumstances, unfortunately unclear, the old renderManagner 
>>> tries to refresh an image. This fails with an NPE in the following
>>> line as its MapDisplay is null.
>>> 
>>> (in CompositeRendererImpl.java)
>>> 377         Dimension displaySize = 
>>> getContext().getMapDisplay().getDisplaySize();
>>> 
>>> the stack trace is the following:
>>> 
>>> java.lang.NullPointerException
>>>     at 
>>> net.refractions.udig.project.internal.render.impl.CompositeRendererImpl.refreshImage(CompositeRendererImpl.java:377)
>>>     at 
>>> net.refractions.udig.project.internal.render.impl.CompositeRendererImpl.refreshImage(CompositeRendererImpl.java:296)
>>>     at 
>>> net.refractions.udig.project.internal.render.impl.RenderExecutorComposite$CompositeRendererJob.incrementalUpdate(RenderExecutorComposite.java:119)
>>>     at 
>>> net.refractions.udig.project.internal.render.impl.RenderExecutorComposite$CompositeRendererJob.startRendering(RenderExecutorComposite.java:166)
>>>     at 
>>> net.refractions.udig.project.internal.render.impl.RenderJob.run(RenderJob.java:213)
>>>     at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
>>> 
>>> The problem is quite puzzling as this NPE is not raised systematically.
>>> Should I take any special precaution when setting a map to a MapViewer for 
>>> the second time in order to avoid this error?
>>> 
>>> Thank you for your help.
>>> Stanislas Nanchen.
>>> _______________________________________________
>>> User-friendly Desktop Internet GIS (uDig)
>>> http://udig.refractions.net
>>> http://lists.refractions.net/mailman/listinfo/udig-devel
>> 
>> _______________________________________________
>> User-friendly Desktop Internet GIS (uDig)
>> http://udig.refractions.net
>> http://lists.refractions.net/mailman/listinfo/udig-devel
> 
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to