Skip to content

Crash when begin multiSelect in grid view #1605

Closed

Description

@malkomich

Steps to reproduce

  1. Do a fresh install of the app from the branch multiSelect
  2. Change to grid view
  3. Do a long press on a file or folder

Expected behaviour

The app don't crash and the file/folder is selected

Actual behaviour

The app crash with a NullPointerException

Environment data

Android version: 4.3
Device model: HTC One & Nexus 7

Notes

It seems that only happens the first time just after install

Activity

  1. tobiasKaminsky commented on May 2, 2016

    @tobiasKaminsky
    Contributor

    Process: com.owncloud.android, PID: 7761 java.lang.NullPointerException: Attempt to invoke interface method 'boolean android.view.ActionMode$Callback.onCreateActionMode(android.view.ActionMode, android.view.Menu)' on a null object reference at com.android.internal.policy.PhoneWindow$DecorView$ActionModeCallback2Wrapper.onCreateActionMode(PhoneWindow.java:3531) at android.support.v7.view.SupportActionModeWrapper$CallbackWrapper.onCreateActionMode(SupportActionModeWrapper.java:155) at android.support.v7.app.AppCompatDelegateImplV7$ActionModeCallbackWrapperV7.onCreateActionMode(AppCompatDelegateImplV7.java:1695) at android.support.v7.app.WindowDecorActionBar$ActionModeImpl.dispatchOnCreate(WindowDecorActionBar.java:1008) at android.support.v7.app.WindowDecorActionBar.startActionMode(WindowDecorActionBar.java:498) at android.support.v7.app.AppCompatDelegateImplV7.startSupportActionMode(AppCompatDelegateImplV7.java:645) at android.support.v7.app.AppCompatDelegateImplV14$AppCompatWindowCallbackV14.startAsSupportActionMode(AppCompatDelegateImplV14.java:74) at android.support.v7.app.AppCompatDelegateImplV23$AppCompatWindowCallbackV23.onWindowStartingActionMode(AppCompatDelegateImplV23.java:47) at com.android.internal.policy.PhoneWindow$DecorView.startActionMode(PhoneWindow.java:2748) at com.android.internal.policy.PhoneWindow$DecorView.startActionModeForChild(PhoneWindow.java:2729) at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:812) at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:812) at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:812) at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:812) at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:812) at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:812) at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:812) at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:812) at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:812) at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:812) at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:812) at android.view.View.startActionMode(View.java:5335) at android.view.View.startActionMode(View.java:5319) at android.widget.AbsListView.performLongPress(AbsListView.java:3118) at android.widget.AbsListView$CheckForLongPress.run(AbsListView.java:3059) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

  2. tobiasKaminsky commented on May 2, 2016

    @tobiasKaminsky
    Contributor

    I do not understand where it comes from...
    @AndyScherzinger maybe you have an idea?

    It happens definitively only the first time after a fresh installation.

  3. AndyScherzinger commented on May 2, 2016

    @AndyScherzinger
    Contributor

    @tobiasKaminsky I am clueless :( Also no idea where this comes from.

  4. malkomich commented on May 19, 2016

    @malkomich
    ContributorAuthor

    I've been reviewing deeply the code, and I found some possible clues about the crash:

    OCFileListFragment::registerLongClickListener()
    Maybe the method onItemCheckedStateChanged is not the suitable one to inflate the context menu. In addittion, the menu is being created each time an element is selected or unselected.

    I think we can handle it creating the menu into the method onCreateActionMode, and filter the shown options as is done before with the old menu.

  5. malkomich commented on May 20, 2016

    @malkomich
    ContributorAuthor

    OK Problem found 😄

    The MultiChoiceModeListener was being attached to the current AbsListView when you call the method registerLongClickListener(). But if you change the view mode, the new AbsListView, in this case the GridView, doesn't have any listener set.

    I'm fixing this currently I'll push the changes ASAP ;)

  6. malkomich commented on May 20, 2016

    @malkomich
    ContributorAuthor

    Fixed on PR #1176

    You can review it @tobiasKaminsky @AndyScherzinger ^^

  7. tobiasKaminsky commented on May 20, 2016

    @tobiasKaminsky
    Contributor

    Great @malkomich!
    I will test later!

  8. jesmrec commented on Jun 28, 2016

    @jesmrec
    Member

    Fixed!!!

  9. davivel commented on Jul 5, 2016

    @davivel
    Contributor

    Then we can close :)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions