mirror of
https://github.com/Tencent/MMKV.git
synced 2026-10-17 04:30:56 +08:00
Merge pull request #1244 from wangtao19930524/bugfix/trim_sigbus_fix
This commit is contained in:
+1
-1
@@ -1388,6 +1388,7 @@ void MMKV::trim() {
|
||||
SCOPED_LOCK(m_lock);
|
||||
MMKVInfo("prepare to trim %s", m_mmapID.c_str());
|
||||
|
||||
SCOPED_LOCK(m_exclusiveProcessLock);
|
||||
checkLoadData();
|
||||
if (!isFileValid()) {
|
||||
MMKVWarning("[%s] file not valid", m_mmapID.c_str());
|
||||
@@ -1400,7 +1401,6 @@ void MMKV::trim() {
|
||||
} else if (m_file->getFileSize() <= m_expectedCapacity) {
|
||||
return;
|
||||
}
|
||||
SCOPED_LOCK(m_exclusiveProcessLock);
|
||||
|
||||
fullWriteback();
|
||||
auto oldSize = m_file->getFileSize();
|
||||
|
||||
Reference in New Issue
Block a user