Closed Bug 119504 Opened 24 years ago Closed 24 years ago

Local: Empty trash puts the new trash folder in the wrong place

Categories

(MailNews Core :: Backend, defect, P3)

x86
Windows 2000
defect

Tracking

(Not tracked)

VERIFIED FIXED
mozilla0.9.8

People

(Reporter: naving, Assigned: waterson)

References

Details

(Keywords: regression)

Attachments

(1 file, 5 obsolete files)

It doesn't sort the new rash folder w.r.t other folders.
Status: NEW → ASSIGNED
Keywords: regression
workaround : open and close the twisty on acct level folder
Priority: -- → P3
Target Milestone: --- → mozilla0.9.8
Attached patch proposed fix (obsolete) — — Splinter Review
Insertion sort wasn't correct, I think this is the right fix.
cc some contributors for review. I don't know how it was working up until now. more likely that we changed something that caused this code to be called.
QA Contact: esther → sheelar
Comment on attachment 64544 [details] [diff] [review] proposed fix looks good to me r=varga
Attachment #64544 - Flags: review+
cc hyatt, looking for sr?
Comment on attachment 64544 [details] [diff] [review] proposed fix sr=waterson
Attachment #64544 - Flags: superreview+
fixed
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Reopening, backed out the fix. I will need to do some more investigation, looks like it may break rename folder in some cases.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
This is a duplicate of bug 113788 AFAICS.
*** Bug 113788 has been marked as a duplicate of this bug. ***
Attached patch proposed fix (obsolete) — — Splinter Review
new insertion sort, gives the correct position for all the cases tested so far.
Attachment #64544 - Attachment is obsolete: true
Attached patch fix (obsolete) — — Splinter Review
Actually, I think this might be what we want. I'll double-check.
Attachment #65166 - Attachment is obsolete: true
I don't think sorting is the problem here. I spent some time looking at the log with NSPR_LOG_MODULES=nsXULTemplateBuilder:5, and I'm seeing pretty bizarre behavior from the mailnews datasource. Perhaps this will all get better with the fix for bug 120203? For example, created the following folder structure: imap://waterson@dredd.mcom.com/ | +--> dummy top-level folder | +--> dummy child folder Then I renamed ``dumy top-level folder'' to ``rufus''. As part of the rename, the ``rufus'' folder was opened. The template builder asked for its kids, and got ``dummy child folder-1'' in response to its query. And then, the datasource push-notified the builder that ``rufus'' had a new child folder, ``dummy child folder''. (Why not just respond to the initial query instead of push notifying?) Unfortunately, this happened _before_ we'd removed the ``dummy top-level folder'', which trips a bug that the rdfliner will get its knickers in a horrible knot if there are two rows with the same URI in the builder. (Which happens, because ``dummy child folder'' is already present under ``dummy top-level folder''.) I'll look around and see if I can find that bug -- fixing it might smooth over this problem. But, we could definitely improve things by re-ordering the notifications. For example, the folder rename operation should be processed without any hitches (and without the above bug being fixed) if you: - unassert the membership of the old folder from its container - assert the membership of the new folder to its container (You have to do this because you're changing the identity of the folder when you monkey with its URI; otherwise, you could just kick out an `onchange' notification for the folderName property.)
Also, there _is_ a bug here with sorting: with respect to attachment 65189 [details] [diff] [review], I'm pretty convinced that it's the right fix.
I don't think I'd filed a bug on the one-resource-per-rdfliner problem, so I filed one. I've added a dependency on bug 120229.
Depends on: 120229
Applying the changes from bug 120203 significantly improve things! I'm still seeing a bizarre problem where having open top-level folders throws off the insertion. Looking at that now.
Depends on: 120203
Okay, I was wrong on several counts. It looks like naving has already implemented most of my RDF notification hacking suggestions in bug 120203. Furthermore, there was a serious problem with the way that we inserted new rows that had nothing to do with duplicate folders (so I'm removing the dependency on bug 120229). I'm going to steal this bug, as it's mostly an rdfliner problem. Patch coming up...
Assignee: naving → waterson
Status: REOPENED → NEW
No longer depends on: 120229
Attached patch complete fix (obsolete) — — Splinter Review
So it turns out that ReplaceMatch() was pretty broken. It was failing to account for any open subtrees that preceded the insertion point. I fixed this by having nsOutlinerRows::InsertElementAt return an iterator that bookmarks the insertion point. Since iterators know their absolute row index, we can pass this along to the OpenSubtree call. Sorry for the runaround on this one naving: do you think you could give this patch a try? It seems to work for me when combined with your patch from bug 120203.
Attachment #65189 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Keywords: review
It turns out that this should fix the problem, with or without changes in bug 120203. (However, those changes ought to make the operation a bit speedier!)
Comment on attachment 65208 [details] [diff] [review] complete fix Argh! Almost there, but doesn't quite work. (Try on a folder nested two deep...)
Attachment #65208 - Flags: needs-work+
Attached patch this one is money, baby! (obsolete) — — Splinter Review
Fixes row accounting in nsOutlinerRows::Subtree::InsertRowAt. When walking up, I needed to count one against the rowIndex for each parent to which we ascended. So, a summary of these changes: - Fix insertion sort in nsXULOutlinerBuilder::ReplaceMatch. We were decrementing |right| too aggressively. - Alter nsOutlinerRows::InsertRowAt to return an iterator, so that we know the absolute row index of the newly inserted row. Specifically, this allows us to properly account for open folders that precede us in the subtree. - Alter nsOutlinerRows::Subtree::InsertRowAt to do the gruntwork of computing the absolute row index of the inserted row. After insertion, it crawls back to the root of the tree, accumulating path information into an iterator. - Merge with Jan's recent changes.
Attachment #65208 - Attachment is obsolete: true
waterson, I will test your last patch.
I applied and tested the latest patch. No problems so far. Although I can't test it with local/pop folders since they are horked.
Attachment #65248 - Flags: review+
Comment on attachment 65248 [details] [diff] [review] this one is money, baby! r=varga
sr=hyatt
It work fine for me. thanks for fixing it. There is one minor nit about one case. Two folders like this b child of a a --b if you delete b, the twisty of a is still there. I don't know if it something related or different.
Yeah, I've seen that, too. Let's file another bug on that: I'm pretty sure it's a different issue.
While investigating bug 95748, I discovered a small problem with attachment 65248 [details] [diff] [review]. Specifically, the initial accumulation of |rowIndex| isn't quite right in nsOutlinerRows::Subtree::InsertRowAt: it starts down one row too far, and doesn't count the first row. Here's the difference between attachment 65248 [details] [diff] [review] and this patch: @@ -59,7 +59,7 @@ + iterator result; + result.Push(this, aIndex); + -+ for ( ; aIndex > 0; --aIndex, ++rowIndex) { ++ for ( ; --aIndex >= 0; ++rowIndex) { + // Account for open subtrees in the absolute row index. + const Subtree *subtree = mRows[aIndex].mSubtree; + if (subtree) It doesn't include the subtree size of the row that was just added (that won't affect the insertion position), but it _does_ include the subtree size of the first row (index 0) in the current subtree.
Attachment #65248 - Attachment is obsolete: true
Blocks: 96748
One more change (to code that's actually not used right now): +nsOutlinerRows::iterator::Push(Subtree *aParent, PRInt32 aChildIndex) +{ + if (mTop < kMaxDepth - 1) { -+ for (PRInt32 i = mTop - 1; i >= 0; ++i) ++ for (PRInt32 i = mTop; i >= 0; ++i) + mLink[i + 1] = mLink[i]; + + mLink[0].mParent = aParent; + mLink[0].mChildIndex = aChildIndex; ++ ++mTop; + } + else + NS_ERROR("overflow"); I screwed up the implementation of `Push': mTop is the last valid index, so I was off-by-one in the loop. Also, I forgot to increment mTop after pushing.
a=blizzard on behalf of drivers for 0.9.8
Keywords: mozilla0.9.8+
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago → 24 years ago
Resolution: --- → FIXED
is a clobber required for this fix? I just built with it from cvs, and now crash on linux shortly after clicking the mailnews icon bottom right in browser. Deleting all in dist and rebuilding didn't help. Backing out this checkin and rebuilding cured the crash however. The backtrace from a non-debug is short: (gdb) bt #0 0x40f85b4d in nsOutlinerRows::iterator::Push () from libgkcontent.so #1 0x40f85998 in nsOutlinerRows::Subtree::InsertRowAt () from libgkcontent.so (gdb)
No, I'm a moron, and didn't check that last bit of patch I attached very carefully (comment 29). The fix is in the tree now (after two tries!): update mozilla/content/xul/templates/src/nsOutlinerRows.cpp, rebuild content. Sorry.
Twisty does not go away after empty trash with folders or after deleting a subfolder is a known problem. I found a bug 88273 an old one which describes the same problem. I don't think we need to log a new bug for that.
No longer depends on: 120203
verified this on 2002-01-25-06 linux, win98 2002-01-24-06 mac os x
Status: RESOLVED → VERIFIED
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: