Field

Ticket #84 (closed defect: fixed)

Opened 4 months ago

Last modified 4 months ago

Closing sometimes merges open sheets

Reported by: mikey Assigned to: marc
Priority: major Milestone:
Component: core Version:
Keywords: Cc:

Description

This doesn't happen all the time, but some of the time when I have multiple sheets open, one of them always tends to copy itself onto another sheet when closing Field (while the sheets are still open). It only happens one way and only one of the sheets is affected and it doesn't happen all the time.

Attachments

output.txt (82.8 kB) - added by mikey on 08/01/2008 06:24:12 AM.
the output when opening "foo2"

Change History

08/01/2008 05:37:53 AM changed by marc

So, if I understand you right, ctrl-c'ing Field while it has multiple sheets open sometimes results in a a sheet, when you open it next time, with the contents of another sheet in it?

08/01/2008 05:38:29 AM changed by mikey

That is correct.

08/01/2008 05:46:11 AM changed by marc

  • status changed from new to assigned.

Well, that seems like a real show-stopper. I'll try and track this down right now.

08/01/2008 05:48:18 AM changed by marc

Any exceptions thrown on exit on or startup?

08/01/2008 05:50:11 AM changed by mikey

i will try and see if I can duplicate when it happens and post the results.

08/01/2008 05:57:05 AM changed by marc

Well, I'm damned if I can duplicate this. But at the same time, it looks like all of the exit hooks are running in their own threads which has got to be suspect number one --- this is alarmingly multithreaded in what is generally a single threaded piece of software.

I'm going to change that, and then ask you to give that another go.

08/01/2008 06:06:26 AM changed by marc

Give changeset:135 a try --- this serializes all of the exit hooks so only one thing is trying to save at a time. Obviously this is not as satisfying as actually finding the race condition...

08/01/2008 06:10:39 AM changed by mikey

I just did an update, and I can't run it because it says its missing class FastVisualElementOverridesDispatchAbove?

08/01/2008 06:16:16 AM changed by marc

yikes! fixed.

08/01/2008 06:23:21 AM changed by mikey

I will go and test it. But I also figured out how I can replicate it.

I have two sheets open. One of them, say "foo", I use to "mark" elements. I then use another sheet, "foo2", to look at allMarked() and pop off the top element, lets call "box". I then do Templating.simpleCopy() of another element within "foo2" and give it the same name as "box". This new box is created in "foo2". I close Field. When opening Field back up, I look at the contents of "foo2" and it shows all the elements from "foo" as well as the original contents of "foo2". I will upload the output when opening "foo2".

08/01/2008 06:24:12 AM changed by mikey

  • attachment output.txt added.

the output when opening "foo2"

08/01/2008 06:37:55 AM changed by marc

Ok. The error is far likelier to be inside Templating.simpleCopy() than it is to be inside the saving code. I bet you're use case of simpleCopy is screwing up the hierarchy of elements somehow and that's making everything get stuffed on exit/reload.

Of course what you are doing sounds like an excellent thing to get working correctly. I'll keep working on it.

08/01/2008 06:51:11 AM changed by marc

Damn it. I still cant duplicate it. I can have two sheets foo and foo2 and a box in foo that copies anything marked into the sheet that it's marked in or a box in foo that copies anything marked into foo and I can wail on these boxees in random orders save, save-as and close and everything is fine.

One thought: do the boxes that you are copying hold references to other boxes in either properties? That kind of a leak (although there's code to try and stop that) could be an issue.

08/01/2008 06:58:04 AM changed by mikey

Okay, I thimk it might have nothing to do with Templating.simpleCopy().

I've been running this test for the past couple minutes. To tell you the whole story first, when "foo2" opens up, it automatically adds a mouselistener+keylistener to the canvas to listen for a shift+click. This shift+click will look at allMarked(), if there is anything, it will do allMarked().pop() to retrieve an element (and this is where my last reply comes in).

However, I commented out everything but allMarked().pop() and it still gives me the error. So I decided to just print "HI" instead of do allMarked().pop(). Trying to replicate the error several times with just printing "HI" was a failure. I could not get the error (which is good). I then just uncommented the line (_a.mar = allMarked().pop() ) and tried to replicate the error. The first time I tried to replicate it, I was successful. strange?

So yea, even without Templating.simpleCopy() the problem was still there.

08/01/2008 07:19:06 AM changed by marc

  • status changed from assigned to closed.
  • resolution set to fixed.

ok: it's the _a.mar code.

It's bad news if you store (persist) a reference to an element that lives in sheet Foo in an element that lives in sheet Bar.

If you change that to _a.mar_ (note trailing underscore says "don't persist this") your problems will disappear completely.

Of course, we're still in bugsville: the persistance code should catch this case, and it isn't and that's the source of the trouble here.

Off to go and take a look at how to fix that problem... #86