wistein / TourCount

TourCount is an Android App that supports species-specific counting of butterflies in nature.
4 stars 3 forks source link

Double Clicking on the Save feature causes the application to crash. #20

Closed rezamusic881 closed 6 years ago

rezamusic881 commented 6 years ago

Expected behavior

Supposedly, Application does not crash when User clicks "Save Feature" in "Counting Menu and Add Species" menu.
####
Actual behavior

The app crashes when the User clicks "Save Feature" in "Calculate and Add Species" menu.
###
How to reproduce
1. Instal App [here](TourCount (A counting app for species-specific registering of butterflies.) - https://f-droid.org/app/com.wmstein.tourcount) 2.Run the app 3.Sign in at "Counting Feature" ![Screenshot_2018-06-02-01-30-53-295_com.whatsapp.png](https://cdn.steemitimages.com/DQmXE393fe3vuyVx7HfkHnw8ZVHyUcb7eEATwjzEYoQt4aQ/Screenshot_2018-06-02-01-30-53-295_com.whatsapp.png) 4.Click "Pencil icons" first to access the "Feature Add Species". ![Screenshot_2018-06-02-01-30-57-553_com.whatsapp.png](https://cdn.steemitimages.com/DQmUrCrBSG6ji7kfiYmnZEozzLKa86BDgdgEDm9kNm94daQ/Screenshot_2018-06-02-01-30-57-553_com.whatsapp.png) 5.Please access "Feature Add Species" and fill in the type of species you want to add. ![Screenshot_2018-06-02-01-31-02-943_com.whatsapp.png](https://cdn.steemitimages.com/DQmQRcmxRJbx6ykSVEAQW5ajMFuJbMHsHF8US6Z41my8kgx/Screenshot_2018-06-02-01-31-02-943_com.whatsapp.png) 6.Do a "Double click" on "Save Feature" quickly, Then the application will crash. ![Screenshot_2018-06-02-01-31-06-731_com.whatsapp.png](https://cdn.steemitimages.com/DQmaUbJLoXWXG88tkAKN52iJpA7D2gMNfnqZsRb2pYxs4Vc/Screenshot_2018-06-02-01-31-06-731_com.whatsapp.png) ![Screenshot_2018-06-02-00-00-19-046_com.wmstein.tourcount.png](https://cdn.steemitimages.com/DQmekmcaJJQb52TQ3WRrVSDDP7ogj42ccoJAbhyUqBQY5XW/Screenshot_2018-06-02-00-00-19-046_com.wmstein.tourcount.png) ####
Environment
* ###### Device : Redmi Note 5A * ###### System Operating : 7.1.0 Nougat * ###### App Version : 3.0.3 *** *** ####
Recording Of The Issues
https://youtu.be/_2-5Sw_6nC0 *** ####
Logcat
######
Proof logcat that the application is experiencing Crash & Error Code
``` 06-02 01:25:09.227 23082 23082 E AndroidRuntime: FATAL EXCEPTION: main 06-02 01:25:09.227 23082 23082 E AndroidRuntime: Process: com.wmstein.tourcount, PID: 23082 06-02 01:25:09.227 23082 23082 E AndroidRuntime: java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/user/0/com.wmstein.tourcount/databases/tourcount.db 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java:55) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at android.database.sqlite.SQLiteDatabase.updateWithOnConflict(SQLiteDatabase.java:1548) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at android.database.sqlite.SQLiteDatabase.update(SQLiteDatabase.java:1525) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at com.wmstein.tourcount.database.CountDataSource.updateCountName(CountDataSource.java:181) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at com.wmstein.tourcount.EditSectionActivity.saveData(EditSectionActivity.java:304) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at com.wmstein.tourcount.EditSectionActivity.onOptionsItemSelected(EditSectionActivity.java:428) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at android.app.Activity.onMenuItemSelected(Activity.java:3382) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:407) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at android.support.v7.app.AppCompatActivity.onMenuItemSelected(AppCompatActivity.java:195) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at android.support.v7.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:108) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at android.support.v7.app.AppCompatDelegateImplV9.onMenuItemSelected(AppCompatDelegateImplV9.java:674) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at android.support.v7.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:822) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at android.support.v7.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:171) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:973) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:963) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at android.support.v7.widget.ActionMenuView.invokeItem(ActionMenuView.java:624) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at android.support.v7.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:150) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at android.view.View.performClick(View.java:5647) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at android.view.View$PerformClick.run(View.java:22462) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:754) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at android.os.Looper.loop(Looper.java:163) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6361) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904) 06-02 01:25:09.227 23082 23082 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794) ```
wistein commented 6 years ago

Thank you for testing the app. I could reproduce the failure.

Fixed in CountDataSource.java with commit 08f6a84 (allow writing into DB only as long as DB is open) .