From 9786cccfb44cd4b38f2ca3f1ff1dc139c4e09d61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyanghuaxuan=E2=80=9D?= <“646903573@qq.com”> Date: Tue, 19 Jan 2021 16:38:18 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=E7=83=AD=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=8B=89=E8=B5=B7=E6=8E=88=E6=9D=83=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/wxwx/flutter_alibc/FlutterAlibcHandle.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/android/src/main/java/com/wxwx/flutter_alibc/FlutterAlibcHandle.java b/android/src/main/java/com/wxwx/flutter_alibc/FlutterAlibcHandle.java index a6ee0a8..2f5a0a1 100644 --- a/android/src/main/java/com/wxwx/flutter_alibc/FlutterAlibcHandle.java +++ b/android/src/main/java/com/wxwx/flutter_alibc/FlutterAlibcHandle.java @@ -48,16 +48,15 @@ import java.util.Map; public class FlutterAlibcHandle { private static FlutterAlibcHandle handle; - private Registrar register; + private static Registrar register; //第一次调用getInstance register不能为空 public static FlutterAlibcHandle getInstance(Registrar register) { - if (handle == null) { + synchronized (FlutterAlibcHandle.class) { handle = new FlutterAlibcHandle(); - handle.register = register; + FlutterAlibcHandle.register = register; } - } return handle; }