Closed
Bug 888039
Opened 12 years ago
Closed 12 years ago
Use support library's SimpleCursorAdapter if swapCursor() is needed
Categories
(Firefox for Android Graveyard :: Theme and Visual Design, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 26
People
(Reporter: sriram, Assigned: sriram)
References
Details
(Whiteboard: fixed-fig)
Attachments
(2 files, 1 obsolete file)
2.44 KB,
patch
|
Margaret
:
review+
|
Details | Diff | Splinter Review |
2.31 KB,
patch
|
Margaret
:
review+
|
Details | Diff | Splinter Review |
swapCursor() is only available on pre-honeycomb devices.
Assignee | ||
Comment 1•12 years ago
|
||
Thanks Android for you Loader, but don't force us to use newer methods!
Attachment #768607 -
Flags: review?(margaret.leibovic)
Comment 2•12 years ago
|
||
Comment on attachment 768607 [details] [diff] [review]
Patch
We also use swapCursor in BrowserSearch.java. Let's change that, too.
Attachment #768607 -
Flags: review?(margaret.leibovic) → review-
Assignee | ||
Comment 3•12 years ago
|
||
Using the support library.
Attachment #769046 -
Flags: review?(margaret.leibovic)
Assignee | ||
Updated•12 years ago
|
Summary: NSME on VisitedPage → Use support library's SimpleCursorAdapter if swapCursor() is needed
Comment 4•12 years ago
|
||
Just curious here, is there a reason we want to be using swapCursor instead of changeCursor? The docs say that changeCursor will close the cursor for us, but swapCursor won't. We're currently not doing anything with the cursor that swapCursor returns, so are we ending up with a bunch of unclosed cursors?
Assignee | ||
Comment 5•12 years ago
|
||
(In reply to :Margaret Leibovic from comment #4)
> Just curious here, is there a reason we want to be using swapCursor instead
> of changeCursor? The docs say that changeCursor will close the cursor for
> us, but swapCursor won't. We're currently not doing anything with the cursor
> that swapCursor returns, so are we ending up with a bunch of unclosed
> cursors?
I believe lucasr added swapCursor() because android recommends it.
http://developer.android.com/reference/android/app/LoaderManager.html <-- search for swapCursor() in their example implementation. They've documented it.
Assignee | ||
Comment 6•12 years ago
|
||
From their docs:
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
// Swap the new cursor in. (The framework will take care of closing the
// old cursor once we return.)
mAdapter.swapCursor(data);
... more junk code ...
}
Comment 7•12 years ago
|
||
Okay, I trust Lucas knows what he's doing, but I'm going to needinfo him just to make sure. However, I'm fine with landing this patch right now since he's away for a few days.
Flags: needinfo?(lucasr.at.mozilla)
Updated•12 years ago
|
Attachment #769046 -
Flags: review?(margaret.leibovic) → review+
Updated•12 years ago
|
Attachment #768607 -
Attachment is obsolete: true
Assignee | ||
Comment 8•12 years ago
|
||
Whiteboard: fixed-fig
Comment 9•12 years ago
|
||
(In reply to :Margaret Leibovic from comment #7)
> Okay, I trust Lucas knows what he's doing, but I'm going to needinfo him
> just to make sure. However, I'm fine with landing this patch right now since
> he's away for a few days.
SimpleCursorLoader owns the cursor and closes it for us when needed. We only need to make sure we don't keep dangling references to closed cursors. Have a look at SimpleCursorLoader's implementation for reference.
Flags: needinfo?(lucasr.at.mozilla)
Assignee | ||
Comment 10•12 years ago
|
||
Lucas asked me to file a followup for bug 887982 and bug 887985. Reusing this bug as this tracks a similar issue, and the bug is trivial.
Attachment #769768 -
Flags: review?(margaret.leibovic)
Comment 11•12 years ago
|
||
Comment on attachment 769768 [details] [diff] [review]
Patch: CursorAdapter
I feel like we should start a wiki page about Cursor-related best practices. Maybe I'll ask ckitching to do that because he's also been fixing some Cursor issues recently.
Attachment #769768 -
Flags: review?(margaret.leibovic) → review+
Updated•12 years ago
|
Assignee: nobody → sriram
Assignee | ||
Comment 12•12 years ago
|
||
Updated•12 years ago
|
Blocks: new-about-home
Comment 13•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/2f186c2d4a41
https://hg.mozilla.org/mozilla-central/rev/cfcde93a090f
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 26
Updated•5 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•