[E] Old Press Convo Getting Stuck Under New Press Convo

Post about any bugs or other issues that you find on AAO.

Moderator: EN - Forum Moderators

User avatar
Enthalpy
Community Manager
Posts: 5169
Joined: Wed Jan 04, 2012 4:40 am
Gender: Male
Spoken languages: English, limited Spanish

Re: [E] Old Press Convo Getting Stuck Under New Press Convo

Post by Enthalpy »

I've found the cause of the original bug, but I'm stuck on how to actually fix it. Here's what happens:

* As expected, the actual trial data manipulation goes as expected.
* Now it's time to manipulate the row map. From rowSectionMapEdit, row_section_row_map's edit method starts editing the trial. As expected, it enters the CE_Statement_Insert case.
* The index of the new row map block to create is found correctly. So, now the program prepares to actually insert the block.
* The block is inserted without a problem! The refreshAction is logged. All the keys are correct, but the comment above the method is incorrect! "Log deletions at the proper position relative to the beginning of the interval," should read "Log insertions at the proper position relative to the beginning of the visible row_map." The object's index is determined using the getStart method, which adds the heights together for all visible blocks ("pieces" of the row_map) from the first to the present. If the position was determined relative to the interval, there would be no need to look at other blocks. This observation becomes critical later.
* Statement indices are updated without a problem.
* The statement's press conversation is now opened. The CE_Close command is run, which hides the opened press conversation, setting its visibility to off, among other things. The other visibilities and heights are adjusted as expected in the row_map, and all of this is simply added to the log.
* With the updatesToPerform now known, AAO goes to work at applying the logged updates to row_section and row_section_content. It starts with the first one in the stack, which corresponds to inserting the new statement simply existing.
* The navigator tries to go to the specified index. Here is where some of the earlier decisions have their consequences... First, the index the update is applied to isn't index within the interval, but the index within the visible rowmap. And if you already have a statement with a press conversation opened up and try to create a new statement to the right... the press conversation has been hidden since the insertion index was defined. The visible rowmap is now shorter than it was when the statement insertion index was created, so it tries to insert at an index that's too far right! If the index doesn't exist, the navigator never gets to the desired index, and throws a NavigatorOnNullBlock exception! That is why the necessary conditions for this bug are creating a new cross-examination to the right of an opened statement, and having few if any frames below the cross-examination! If you insert a statement left, the now-invisible parts of the rowmap are after the insertion, causing no problem for the navigator. If you have too many frames after the navigator, the index does exist, just not where you'd expect it. For some reason, that makes no difference in the other display functions.

And that's as far as my bug identification efforts have gotten. There are a few other questions about this particular bug Is this the same one Broytio reported?, Does this bug affect more than just adding new statements in a cross-examination?, Why does navigator picking up the wrong index not cause other problems, and of course, How are we going to fix this one?!

I'll leave this to you, Unas, since the row_map system is still mostly a complete mystery to me!
[D]isordered speech is not so much injury to the lips that give it forth, as to the disproportion and incoherence of things in themselves, so negligently expressed. ~ Ben Jonson
User avatar
Unas
Admin / Site programmer
Posts: 8850
Joined: Tue Jul 10, 2007 4:43 pm
Gender: Male
Spoken languages: Français, English, Español
Contact:

Re: [E] Old Press Convo Getting Stuck Under New Press Convo

Post by Unas »

Thanks Enth ! Quite impressive for someone who claims it's still a complete mystery ^^


Your analysis seems pretty good at first glance : the problem might very well be that the index fed into the refreshAction is wrong, or rather becomes wrong after another modification happens that should have shifted it.
That's pretty troublesome indeed, I'll have to take some time to check.
The best solution may be for "logRefreshAction" to actually return the block directly, instead of computed index and number, since that computation might become invalid later on. Then, "flushRefreshActions" goes through all those blocks and computes their index and number, after all operations are complete.
ImageImageImage
If knowledge can create problems, it is not through ignorance that we can solve them.
Si le savoir peut créer des problèmes, ce n'est pas l'ignorance qui les résoudra. ( Isaac Asimov )
Post Reply