Skip to content

Commit 7c5d9d4

Browse files
committed
see 11/15 log
1 parent beeff0d commit 7c5d9d4

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

update_log.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
###
2+
#### 16/11/15 完善正则工具类
23
#### 16/11/14 新增启动服务
34
#### 16/11/13 新增判断sim卡是否准备好
45
#### 16/11/12 最近一直在博客搬家,所以更得有点少,新增重启到recovery和bootloader,新增获取launcher activity

utilcode/src/main/java/com/blankj/utilcode/utils/CrashUtils.java

+14-6
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@
2525
*/
2626
public class CrashUtils implements Thread.UncaughtExceptionHandler {
2727

28-
private static CrashUtils mInstance = new CrashUtils();
29-
private UncaughtExceptionHandler mHandler;
30-
private boolean mInitialized;
31-
private static String crashDir;
32-
private String versionName;
33-
private int versionCode;
28+
private volatile static CrashUtils mInstance;
29+
30+
private UncaughtExceptionHandler mHandler;
31+
private boolean mInitialized;
32+
private String crashDir;
33+
private String versionName;
34+
private int versionCode;
3435

3536
private CrashUtils() {
3637
}
@@ -42,6 +43,13 @@ private CrashUtils() {
4243
* @return 单例
4344
*/
4445
public static CrashUtils getInstance() {
46+
if (mInstance == null) {
47+
synchronized (CrashUtils.class) {
48+
if (mInstance == null) {
49+
mInstance = new CrashUtils();
50+
}
51+
}
52+
}
4553
return mInstance;
4654
}
4755

0 commit comments

Comments
 (0)