nost123 / apps-for-android

Automatically exported from code.google.com/p/apps-for-android
Apache License 2.0
0 stars 0 forks source link

[WikiNotes] Backing over deleted note crashes WikiNotes #14

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
[Reported against r17 of WikiNotes running in beta 0.9 emulator.]

Problem: Back key crashes WikiNotes if previous note was deleted.

To reproduce: Create some notes, delete one, go to the notes list, and
start hitting the Back key. When you get back to the deleted note,
WikiNotes crashes (and then restarts).

Another problem: WikiNotes creates too much useless history? As one
continues to use WikiNotes, the activity history continues to accumulate,
including references to notes that have subsequently been deleted. The Back
key becomes useless because so many references have been maintained.
Even after WikiNotes restarts, the old activity seems to be retained. This
makes me wonder if the activity-based mechanism that WikiNotes exemplifies
is really so great in practice. Notice how many windows die when WikiNotes
crashes below... A much shorter, hierarchical history would be more useful,
and would retain no more than a few windows in the worst case.

This trace shows the crash due to the deleted note:

E/AndroidRuntime(  241):
 Uncaught handler: thread main exiting due to uncaught exception

E/AndroidRuntime(  241): java.lang.RuntimeException:
 Unable to resume activity
 {com.google.android.wikinotes/com.google.android.wikinotes.WikiNotes}:
  android.database.CursorIndexOutOfBoundsException:
   Index 0 requested, with a size of 0

E/AndroidRuntime(  241):
        at android.app.ActivityThread.performResumeActivity
        at android.app.ActivityThread.handleResumeActivity
        at android.app.ActivityThread$H.handleMessage
        at android.os.Handler.dispatchMessage
        at android.os.Looper.loop
        at android.app.ActivityThread.main
        ...

E/AndroidRuntime(  241): Caused by:
  android.database.CursorIndexOutOfBoundsException:
   Index 0 requested, with a size of 0
        at android.database.AbstractCursor.checkPosition
        at android.database.AbstractWindowedCursor.checkPosition
        at android.database.AbstractWindowedCursor.getString
        at android.database.CursorWrapper.getString
        at com.google.android.wikinotes.WikiNotes.onResume
        at android.app.Instrumentation.callActivityOnResume
        at android.app.Activity.performResume
        at android.app.ActivityThread.performResumeActivity
        ... 10 more

I/ActivityManager(   49): Process com.google.android.wikinotes has died.

Then all the WikiNotes windows die... There are a lot!

I/WindowManager(   49): WIN DEATH: Window{43519778
com.google.android.wikinotes/
com.google.android.wikinotes.WikiNotes}

I/WindowManager(   49): WIN DEATH: Window{434e53c8
com.google.android.wikinotes/
com.google.android.wikinotes.WikiNotesList}

I/WindowManager(   49): WIN DEATH: Window{434a3008
com.google.android.wikinotes/
com.google.android.wikinotes.WikiNotesList}

I/WindowManager(   49): WIN DEATH: Window{435092c8
com.google.android.wikinotes/
com.google.android.wikinotes.WikiNotes}

I/WindowManager(   49): WIN DEATH: Window{4346bac0
com.google.android.wikinotes/
com.google.android.wikinotes.WikiNotes}

I/WindowManager(   49): WIN DEATH: Window{43555a28
com.google.android.wikinotes/
com.google.android.wikinotes.WikiNotes}

I/WindowManager(   49): WIN DEATH: Window{43453448
com.google.android.wikinotes/
com.google.android.wikinotes.WikiNotes}

I/WindowManager(   49): WIN DEATH: Window{43548878
com.google.android.wikinotes/
com.google.android.wikinotes.WikiNotesList}

I/WindowManager(   49): WIN DEATH: Window{434be5e8
com.google.android.wikinotes/
com.google.android.wikinotes.WikiNotes}

I/WindowManager(   49): WIN DEATH: Window{434cfbe0
com.google.android.wikinotes/
com.google.android.wikinotes.WikiNotes}

I/WindowManager(   49): WIN DEATH: Window{434ab348
com.google.android.wikinotes/
com.google.android.wikinotes.WikiNotes}

I/WindowManager(   49): WIN DEATH: Window{4341cd50
com.google.android.wikinotes/
com.google.android.wikinotes.WikiNotes}

I/WindowManager(   49): WIN DEATH: Window{43442488
com.google.android.wikinotes/
com.google.android.wikinotes.WikiNotesList}

I/WindowManager(   49): WIN DEATH: Window{434b4eb8
com.google.android.wikinotes/
com.google.android.wikinotes.WikiNotesList}

I/WindowManager(   49): WIN DEATH: Window{434d1840
com.google.android.wikinotes/
com.google.android.wikinotes.WikiNotes}

I/WindowManager(   49): WIN DEATH: Window{43512458
com.google.android.wikinotes/
com.google.android.wikinotes.WikiNotes}

I/WindowManager(   49): WIN DEATH: Window{4353e098
com.google.android.wikinotes/
com.google.android.wikinotes.WikiNotesList}

I/WindowManager(   49): WIN DEATH: Window{43478fe8
com.google.android.wikinotes/
com.google.android.wikinotes.WikiNotes}

Original issue reported on code.google.com by joe.bowb...@gmail.com on 30 Aug 2008 at 7:04

GoogleCodeExporter commented 8 years ago
Nice find.

Original comment by morri...@gmail.com on 3 Sep 2008 at 3:06

GoogleCodeExporter commented 8 years ago

Original comment by morri...@gmail.com on 13 Nov 2008 at 10:11

GoogleCodeExporter commented 8 years ago

Original comment by morri...@gmail.com on 13 Nov 2008 at 10:19

GoogleCodeExporter commented 8 years ago

Original comment by morri...@gmail.com on 13 Nov 2008 at 10:21

GoogleCodeExporter commented 8 years ago
Fixed in r139.

Now, that fix just corrects the crash by calling finish() if the attempt to 
load data
in onResume() fails;  it doesn't actually alter the history behavior.  You might
argue that the History behavior could be improved, but I actually do view this 
a bit
like a Browser, and think the current history behavior is correct.

If you have a more detailed proposal for how to improve history behavior, 
please do
file it as a new bug and I'll look at it as an enhancement request. 

Original comment by morri...@gmail.com on 13 Nov 2008 at 3:17