Skip to content
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

NPE in ShareUtils in some cases after application minimized #445

Open
httpdispatch opened this issue May 27, 2013 · 1 comment
Open

NPE in ShareUtils in some cases after application minimized #445

httpdispatch opened this issue May 27, 2013 · 1 comment

Comments

@httpdispatch
Copy link
Contributor

It happens when share on twitter or facebook. Dialog is not appearing and NPE occurs. Reproduces this on Android 4.2 emulator

    at com.trovebox.android.app.share.ShareUtils$TwitterShareRunnable.run(ShareUtils.java:153)
    at com.trovebox.android.app.twitter.TwitterUtils.runAfterTwitterAuthentication(TwitterUtils.java:268)
    at com.trovebox.android.app.twitter.TwitterUtils.runAfterTwitterAuthentication(TwitterUtils.java:219)
    at com.trovebox.android.app.PhotoDetailsActivity$PhotoDetailsUiFragment.shareActivePhotoViaTwitter(PhotoDetailsActivity.java:317)
    at com.trovebox.android.app.PhotoDetailsActivity$PhotoDetailsUiFragment$3.run(PhotoDetailsActivity.java:275)
    at com.trovebox.android.app.share.ShareUtils.confirmPrivatePhotoSharingAndRun(ShareUtils.java:79)
    at com.trovebox.android.app.PhotoDetailsActivity$PhotoDetailsUiFragment.confirmPrivatePhotoSharingAndRun(PhotoDetailsActivity.java:344)
    at com.trovebox.android.app.PhotoDetailsActivity$PhotoDetailsUiFragment.onOptionsItemSelected(PhotoDetailsActivity.java:271)
    at android.support.v4.app.Watson.onMenuItemSelected(Watson.java:126)
    at com.actionbarsherlock.ActionBarSherlock.callbackOptionsItemSelected(ActionBarSherlock.java:603)
    at com.actionbarsherlock.internal.ActionBarSherlockNative.dispatchOptionsItemSelected(ActionBarSherlockNative.java:93)
    at org.holoeverywhere.addon.AddonSherlock$AddonSherlockA.onMenuItemSelected(AddonSherlock.java:98)
    at org.holoeverywhere.app.Activity$10.action(Activity.java:306)
    at org.holoeverywhere.app.Activity$10.action(Activity.java:1)
    at org.holoeverywhere.addon.IAddonAttacher$AddonCallback.performAction(IAddonAttacher.java:24)
    at org.holoeverywhere.addon.IAddonBasicAttacher.performAddonAction(IAddonBasicAttacher.java:115)
    at org.holoeverywhere.app.Activity.performAddonAction(Activity.java:528)
    at org.holoeverywhere.app.Activity.onMenuItemSelected(Activity.java:303)
    at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:980)
    at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)
    at com.android.internal.view.menu.SubMenuBuilder.dispatchMenuItemSelected(SubMenuBuilder.java:81)
    at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:149)
    at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
    at com.android.internal.view.menu.MenuPopupHelper.onItemClick(MenuPopupHelper.java:156)
    at android.widget.AdapterView.performItemClick(AdapterView.java:298)
    at android.widget.AbsListView.performItemClick(AbsListView.java:1100)
    at android.widget.AbsListView$PerformClick.run(AbsListView.java:2749)
    at android.widget.AbsListView.onTouchEvent(AbsListView.java:3435)
    at android.view.View.dispatchTouchEvent(View.java:7246)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2168)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1903)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
    at android.widget.PopupWindow$PopupViewContainer.dispatchTouchEvent(PopupWindow.java:1592)
    at android.view.View.dispatchPointerEvent(View.java:7426)
    at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3220)
    at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3165)
    at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4292)
    at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4271)
    at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4363)
    at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:179)
    at android.os.MessageQueue.nativePollOnce(Native Method)
    at android.os.MessageQueue.next(MessageQueue.java:125)
    at android.os.Looper.loop(Looper.java:124)
    at android.app.ActivityThread.main(ActivityThread.java:5041)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
    at dalvik.system.NativeStart.main(Native Method)
java.lang.NullPointerException
    at com.trovebox.android.app.share.ShareUtils$FacebookShareRunnable.run(ShareUtils.java:185)
    at com.trovebox.android.app.facebook.FacebookUtils.runAfterFacebookAuthentication(FacebookUtils.java:171)
    at com.trovebox.android.app.facebook.FacebookUtils.runAfterFacebookAuthentication(FacebookUtils.java:158)
    at com.trovebox.android.app.PhotoDetailsActivity$PhotoDetailsUiFragment.shareActivePhotoViaFacebook(PhotoDetailsActivity.java:306)
    at com.trovebox.android.app.PhotoDetailsActivity$PhotoDetailsUiFragment$4.run(PhotoDetailsActivity.java:286)
    at com.trovebox.android.app.share.ShareUtils.confirmPrivatePhotoSharingAndRun(ShareUtils.java:79)
    at com.trovebox.android.app.PhotoDetailsActivity$PhotoDetailsUiFragment.confirmPrivatePhotoSharingAndRun(PhotoDetailsActivity.java:344)
    at com.trovebox.android.app.PhotoDetailsActivity$PhotoDetailsUiFragment.onOptionsItemSelected(PhotoDetailsActivity.java:282)
    at android.support.v4.app.Watson.onMenuItemSelected(Watson.java:126)
    at com.actionbarsherlock.ActionBarSherlock.callbackOptionsItemSelected(ActionBarSherlock.java:603)
    at com.actionbarsherlock.internal.ActionBarSherlockNative.dispatchOptionsItemSelected(ActionBarSherlockNative.java:93)
    at org.holoeverywhere.addon.AddonSherlock$AddonSherlockA.onMenuItemSelected(AddonSherlock.java:98)
    at org.holoeverywhere.app.Activity$10.action(Activity.java:306)
    at org.holoeverywhere.app.Activity$10.action(Activity.java:1)
    at org.holoeverywhere.addon.IAddonAttacher$AddonCallback.performAction(IAddonAttacher.java:24)
    at org.holoeverywhere.addon.IAddonBasicAttacher.performAddonAction(IAddonBasicAttacher.java:115)
    at org.holoeverywhere.app.Activity.performAddonAction(Activity.java:528)
    at org.holoeverywhere.app.Activity.onMenuItemSelected(Activity.java:303)
    at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:1133)
    at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)
    at com.android.internal.view.menu.SubMenuBuilder.dispatchMenuItemSelected(SubMenuBuilder.java:81)
    at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:149)
    at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
    at com.android.internal.view.menu.MenuPopupHelper.onItemClick(MenuPopupHelper.java:156)
    at android.widget.AdapterView.performItemClick(AdapterView.java:298)
    at android.widget.AbsListView.performItemClick(AbsListView.java:1110)
    at android.widget.AbsListView$PerformClick.run(AbsListView.java:2906)
    at android.widget.AbsListView$1.run(AbsListView.java:3735)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4911)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
    at dalvik.system.NativeStart.main(Native Method)
@httpdispatch
Copy link
Contributor Author

Steps to reproduce.
Open photo details
close and immediately open it again
then try to share photo via twitter or facebook. NPE occurs

It happens because of 2 instances onf fragment are in memory at the same time. One is destroyin and one is creating. And destroying fragment nullify currentInstance variable

httpdispatch added a commit to httpdispatch/mobile-android that referenced this issue May 27, 2013
- HomeFragment: replaced ListView with GridView 
- HomeFragment: currentInstance now is nulled in onDestroy only if it
equals to destroying fragment such as in some cases it is possible that
2 instance of the fragment will be in memory at the time
- HomeFragment: updated image size calculation in the initImageWorker
method
- res/layout/fragment_home.xml: replaced listview with the gridview
- res/layout/list_item_newest_photos.xml: updated paddings
- res/values/const.xml: added
- res/values-land/const.xml: added
httpdispatch added a commit to httpdispatch/mobile-android that referenced this issue May 27, 2013
- GoogleLoginFragment, MainActivity,
PhotoDetailsActivity.PhotoDetailsUiFragment, SyncUploadFragment,
UploadActivity.UploadUiFragment: currentInstance now is nulled in
onDestroy only if it equals to destroying fragment such as in some cases
it is possible that 2 instance of the fragment will be in memory at the
time
- PhotoDetailsActivity.PhotoDetailsUiFragment: updated date format in
photo details to be locale specified
- PhotoDetailsActivity.PhotoDetailsUiFragment: replaced
mImageWorker2.loadImage call with the one with less parameters
- CommonUtils: added formatDateTime method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant