SubhamTyagi / Last-Launcher

Lightweight: Faster than light, Low on memory
GNU General Public License v3.0
169 stars 52 forks source link

Synched mAppsList to prevent ConcurrentModificationException. Should fix #125 and #140 #203

Closed ya9WR closed 2 years ago

ya9WR commented 2 years ago

Every 2nd install from F-Droid crashed Last Launcher on my phone. Also during some nights the installs of apps from Play Store removed Last Launcher as default launcher. After installing the debug version on my phone I saw the ConcurrentModificationException in the crash log files: 2022-10-23 18-19-33_crash.txt

In the debugger I saw that LauncherActivity.loadApps() is called twice for each program installation. Afterwards SortTask.onPostExecute() is called async. My assumption is that during the first execution of SortTask.onPostExecute() the second call of LauncherActivity.loadApps() happened and changed the mAppsList while the for loop in SortTask.onPostExecute() was still ongoing.

After using LauncherActivity.loadApps() and synchronized (mAppsList) for each for loop Last Launcher was running without a crash for a few days and 20+ program installation.