Closed tinevez closed 7 years ago
@tinevez thanks for finding this out!
@tinevez I have a tentative fix for this. It requires addition of a RefPool.getIfExists()
method, so it touches all mastodon projects:
https://github.com/bigdataviewer/mastodon-collection/tree/safe-get-object https://github.com/bigdataviewer/mastodon-graph/tree/safe-get-object https://github.com/fiji/TrackMate3/tree/safe-get-object
Can you have a look? If everything is ok, I'll merge and release...
Sorry for delayed response.
Yes it works! The crash is gone!
It can happen that the Mastodon crashes when modifying the graph several times via its highlight or focus.
The diagnosis is as follow (based on the
unify-views
branch):A
graphChanged
event ends up in calling thepaint()
method of theTrackSchemePanel
.The
paint()
method does mainly two things, in the following order:TrackScheme
vertices get a new value forX
. This calls thelayout()
method of theLineageTreeLayout
class.It regenerates the
ScreenEntities
for the new layout. This involves creating newScreenVertex
es andScreenEdge
s properly linked to theTrackScheme
items currently displayed. This calls thecropAndScale()
method of theLineageTreeLayout
class.Between the call of
layout()
andcropAndScale()
, theScreenEntities
are invalid. They may correspond toTrackScheme
items that moved or disappeared because of the graph change event.This issue is caused by the fact that several classes are notified when the
layout()
method is finished, and interrogate theScreenEntities
. For instance for this bug:A
graphChanged
event ends up in calling thepaint()
method of theTrackSchemePanel
.The
paint()
method calls thelayout()
method of theLineageTreeLayout
class.When the layout is done, The
LayoutListener
of the class are notified (via `layoutChanged()).One of these listener is the
InertialScreenTransformListener
. It notifies itsTransformListener
(viatransformChanged()
).This
transform listener is the
InteractiveDisplayCanvasComponent`. It has several listeners it forward this event to.One of them is the
MouseHighlightHandler
. Calling itstransformChanged()
method causes it to try an grab the currently highlighted edge or vertex.To do so, it calls the
getEdgeAt()
orgetVertexAt()
method of theAbstractTrackSchemeOverlay
class.These two methods rely on
ScreenEntities
to retrieve the desiredTrackScheme
item, but at this time, they are not valid. They link toTrackScheme
items that may have been deleted or moved. Calling a second graph modification event with these items is what causes the crash.