Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[iOS] fix logimplement crash
Browse files Browse the repository at this point in the history
  • Loading branch information
jianhan-he committed Aug 7, 2019
1 parent bc252dc commit 7c48b0d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions weex_core/Source/base/log_defines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

#include "core/manager/weex_core_manager.h"

weex::base::LogImplement* weex::base::LogImplement::g_instance = nullptr;

namespace WeexCore {
struct LogFlattenHelper {
LogFlattenHelper() : mLargeBuf() {}
Expand Down
6 changes: 3 additions & 3 deletions weex_core/Source/base/log_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,9 @@ class LogBase {
class LogImplement {
public:
static LogImplement *getLog() {
static weex::base::LogImplement *mySelf;
static std::once_flag once_flag;
std::call_once(once_flag, []() { mySelf = new LogImplement(); });
return mySelf;
std::call_once(once_flag, []() { g_instance = new LogImplement(); });
return g_instance;
}

void setLogImplement(weex::base::LogBase *logVirtual) {
Expand Down Expand Up @@ -167,6 +166,7 @@ class LogImplement {

private:
weex::base::LogBase *m_log;
static LogImplement *g_instance;
LogImplement() : m_log(nullptr) {}
};
}
Expand Down

0 comments on commit 7c48b0d

Please sign in to comment.