aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ports
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2018-05-17 09:47:30 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-17 14:29:53 +0000
commitd2152c4cde9faa06d41f7aa9ced838e82918e7ee (patch)
tree8f7eadb84e31fbf6cf0325664d766e79990e0933 /src/ports
parent51401f07f2e7c650feb13297cc2f5ad50bbc5144 (diff)
Remove static initializer to register destructor.
Skia cannot have global sk_sp objects because they will register an exit time destructor which will be done through a static initializer. BUG=chromium:843858 Change-Id: I43e3d18c9d8b50ff067414148c7524bffd3523da Reviewed-on: https://skia-review.googlesource.com/128843 Auto-Submit: Ben Wagner <bungeman@google.com> Commit-Queue: Herb Derby <herb@google.com> Reviewed-by: Herb Derby <herb@google.com>
Diffstat (limited to 'src/ports')
-rw-r--r--src/ports/SkFontConfigInterface.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ports/SkFontConfigInterface.cpp b/src/ports/SkFontConfigInterface.cpp
index 0d52c0efc2..f81c48744e 100644
--- a/src/ports/SkFontConfigInterface.cpp
+++ b/src/ports/SkFontConfigInterface.cpp
@@ -11,13 +11,13 @@
#include "SkRefCnt.h"
SK_DECLARE_STATIC_MUTEX(gFontConfigInterfaceMutex);
-static sk_sp<SkFontConfigInterface> gFontConfigInterface(nullptr);
+static SkFontConfigInterface* gFontConfigInterface;
sk_sp<SkFontConfigInterface> SkFontConfigInterface::RefGlobal() {
SkAutoMutexAcquire ac(gFontConfigInterfaceMutex);
if (gFontConfigInterface) {
- return gFontConfigInterface;
+ return sk_ref_sp(gFontConfigInterface);
}
return sk_ref_sp(SkFontConfigInterface::GetSingletonDirectInterface());
}
@@ -25,5 +25,6 @@ sk_sp<SkFontConfigInterface> SkFontConfigInterface::RefGlobal() {
void SkFontConfigInterface::SetGlobal(sk_sp<SkFontConfigInterface> fc) {
SkAutoMutexAcquire ac(gFontConfigInterfaceMutex);
- gFontConfigInterface = std::move(fc);
+ SkSafeUnref(gFontConfigInterface);
+ gFontConfigInterface = fc.release();
}