New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tomdroid ListView crashes on Nexus 7 when turning the screen #52

Closed
obilodeau opened this Issue Aug 23, 2016 · 3 comments

Comments

Projects
None yet
1 participant
@obilodeau
Member

obilodeau commented Aug 23, 2016

Nexus 7, latest revision of Tomdroid installed.

  • start app
  • rotate screen
  • crash

09-12 21:18:32.070: I/ActivityManager(352): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.tomdroid/.ui.Tomdroid bnds=[16,915][144,1043] u=0} from pid 14803
09-12 21:18:32.110: D/dalvikvm(14840): Late-enabling CheckJNI
09-12 21:18:32.110: I/ActivityManager(352): Start proc org.tomdroid for activity org.tomdroid/.ui.Tomdroid: pid=14840 uid=10062 gids={3003, 1015, 1028}
09-12 21:18:32.120: I/dalvikvm(14840): Turning on JNI app bug workarounds for target SDK version 11...
09-12 21:18:32.170: W/ActivityThread(14840): Application org.tomdroid can be debugged on port 8100...
09-12 21:18:32.180: I/ActivityThread(14840): Pub org.tomdroid.notes: org.tomdroid.NoteProvider
09-12 21:18:32.180: I/ActivityThread(14840): Pub org.tomdroid.util.SearchSuggestionProvider: org.tomdroid.util.SearchSuggestionProvider
09-12 21:18:32.370: D/dalvikvm(14840): GC_CONCURRENT freed 213K, 8% free 7468K/8071K, paused 18ms+4ms, total 39ms
09-12 21:18:32.460: I/ActivityManager(352): Displayed org.tomdroid/.ui.Tomdroid: +364ms
09-12 21:18:35.820: I/InputReader(352): Reconfiguring input devices. changes=0x00000004
09-12 21:18:35.820: I/InputReader(352): Device reconfigured: id=2, name='elan-touchscreen', surface size is now 800x1280, mode is 1
09-12 21:18:35.840: I/ActivityManager(352): Config changed: {1.0 0mcc0mnc en_US sw600dp w961dp h528dp lrg land finger -keyb/v/h -nav/h s.40}
09-12 21:18:35.900: D/Tomdroid(14840): Getting note -1
09-12 21:18:35.900: D/AndroidRuntime(14840): Shutting down VM
09-12 21:18:35.900: W/dalvikvm(14840): threadid=1: thread exiting with uncaught exception (group=0x41f6e300)
09-12 21:18:35.900: E/AndroidRuntime(14840): FATAL EXCEPTION: main
09-12 21:18:35.900: E/AndroidRuntime(14840): android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 10
09-12 21:18:35.900: E/AndroidRuntime(14840): at android.database.AbstractCursor.checkPosition(AbstractCursor.java:418)
09-12 21:18:35.900: E/AndroidRuntime(14840): at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:136)
09-12 21:18:35.900: E/AndroidRuntime(14840): at android.database.AbstractWindowedCursor.getInt(AbstractWindowedCursor.java:68)
09-12 21:18:35.900: E/AndroidRuntime(14840): at android.database.CursorWrapper.getInt(CursorWrapper.java:102)
09-12 21:18:35.900: E/AndroidRuntime(14840): at org.tomdroid.ui.Tomdroid.showNoteInPane(Tomdroid.java:835)
09-12 21:18:35.900: E/AndroidRuntime(14840): at org.tomdroid.ui.Tomdroid.onConfigurationChanged(Tomdroid.java:782)
09-12 21:18:35.900: E/AndroidRuntime(14840): at android.app.ActivityThread.performConfigurationChanged(ActivityThread.java:3618)
09-12 21:18:35.900: E/AndroidRuntime(14840): at android.app.ActivityThread.handleConfigurationChanged(ActivityThread.java:3746)
09-12 21:18:35.900: E/AndroidRuntime(14840): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
09-12 21:18:35.900: E/AndroidRuntime(14840): at android.os.Handler.dispatchMessage(Handler.java:99)
09-12 21:18:35.900: E/AndroidRuntime(14840): at android.os.Looper.loop(Looper.java:137)
09-12 21:18:35.900: E/AndroidRuntime(14840): at android.app.ActivityThread.main(ActivityThread.java:4745)
09-12 21:18:35.900: E/AndroidRuntime(14840): at java.lang.reflect.Method.invokeNative(Native Method)
09-12 21:18:35.900: E/AndroidRuntime(14840): at java.lang.reflect.Method.invoke(Method.java:511)
09-12 21:18:35.900: E/AndroidRuntime(14840): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-12 21:18:35.900: E/AndroidRuntime(14840): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-12 21:18:35.900: E/AndroidRuntime(14840): at dalvik.system.NativeStart.main(Native Method)
09-12 21:18:35.910: W/ActivityManager(352): Force finishing activity org.tomdroid/.ui.Tomdroid
09-12 21:18:35.960: D/dalvikvm(597): GC_CONCURRENT freed 434K, 50% free 9668K/19271K, paused 17ms+4ms, total 46ms
09-12 21:18:35.960: D/dalvikvm(597): WAIT_FOR_CONCURRENT_GC blocked 29ms
09-12 21:18:36.440: W/ActivityManager(352): Activity pause timeout for ActivityRecord{42d5ad40 org.tomdroid/.ui.Tomdroid}
09-12 21:18:36.450: I/InputReader(352): Reconfiguring input devices. changes=0x00000004
09-12 21:18:36.450: I/InputReader(352): Device reconfigured: id=2, name='elan-touchscreen', surface size is now 800x1280, mode is 1
09-12 21:18:36.470: I/ActivityManager(352): Config changed: {1.0 0mcc0mnc en_US sw600dp w600dp h880dp lrg port finger -keyb/v/h -nav/h s.41}
09-12 21:18:38.600: D/dalvikvm(352): WAIT_FOR_CONCURRENT_GC blocked 0ms
09-12 21:18:38.680: D/dalvikvm(352): GC_EXPLICIT freed 1084K, 34% free 16445K/24839K, paused 9ms+6ms, total 76ms
09-12 21:18:46.570: W/ActivityManager(352): Activity destroy timeout for ActivityRecord{42d5ad40 org.tomdroid/.ui.Tomdroid}


Imported from Launchpad using lp2gh.

@obilodeau

This comment has been minimized.

Show comment
Hide comment
@obilodeau

obilodeau Aug 23, 2016

Member

(by noahy)
My Tomdroid.java line 835 has this:

        final boolean proposeShortcutRemoval;

Are you sure you have the latest code?

I think I see what the problem is, anyway, can you pull the latest revision and see if it is fixed?

Member

obilodeau commented Aug 23, 2016

(by noahy)
My Tomdroid.java line 835 has this:

        final boolean proposeShortcutRemoval;

Are you sure you have the latest code?

I think I see what the problem is, anyway, can you pull the latest revision and see if it is fixed?

@obilodeau

This comment has been minimized.

Show comment
Hide comment
@obilodeau

obilodeau Aug 23, 2016

Member

(by j-4)
i have the latest revision and it is still a problem.

my line 835 is
private void showNoteInPane(int position) {
somehow you count lines different :-D

The reason is, that you initialize the int "position" with -1.
Why not with 0? is this on purpose?

// restore

    getListView().setSelectionFromTop(index, top);

    if(position >= adapter.getCount() || (position < 0))
        position = 0;

    Cursor item = (Cursor) adapter.getItem(position);
    if (item == null || item.getCount() == 0) {
        TLog.d(TAG, "Index {0} not found in list", position);
        return;
    }
    TLog.d(TAG, "Getting note {0}", position);

I added a check for values below zero for position, which fixes this bug, but initializing the variable with zero would also fix the problem. I do not push this changes now, as I need your opinion on which solution is better.

Member

obilodeau commented Aug 23, 2016

(by j-4)
i have the latest revision and it is still a problem.

my line 835 is
private void showNoteInPane(int position) {
somehow you count lines different :-D

The reason is, that you initialize the int "position" with -1.
Why not with 0? is this on purpose?

// restore

    getListView().setSelectionFromTop(index, top);

    if(position >= adapter.getCount() || (position < 0))
        position = 0;

    Cursor item = (Cursor) adapter.getItem(position);
    if (item == null || item.getCount() == 0) {
        TLog.d(TAG, "Index {0} not found in list", position);
        return;
    }
    TLog.d(TAG, "Getting note {0}", position);

I added a check for values below zero for position, which fixes this bug, but initializing the variable with zero would also fix the problem. I do not push this changes now, as I need your opinion on which solution is better.

@obilodeau

This comment has been minimized.

Show comment
Hide comment
@obilodeau

obilodeau Aug 23, 2016

Member

(by j-4)
woww.. i was only on rev 467, because lp:tomdroid/beta and
lp:~tomdroid-dev/tomdroid/note-editing-and-syncing are not in sync any more.
They were in sync previously, weren't they?

Your fix in note-editing-ans-syncing also fixes the bug, of course.
I just realised, that tomdroid/beta now is owend by the maintainers, so we have to review the changes and merge them byz hand, i suppose!

marking as fix committed!

Member

obilodeau commented Aug 23, 2016

(by j-4)
woww.. i was only on rev 467, because lp:tomdroid/beta and
lp:~tomdroid-dev/tomdroid/note-editing-and-syncing are not in sync any more.
They were in sync previously, weren't they?

Your fix in note-editing-ans-syncing also fixes the bug, of course.
I just realised, that tomdroid/beta now is owend by the maintainers, so we have to review the changes and merge them byz hand, i suppose!

marking as fix committed!

@obilodeau obilodeau added this to the 0.7.2 milestone Aug 23, 2016

@obilodeau obilodeau closed this Aug 23, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment