mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Io: Correct leak on save state.
This was breaking things a bit more every time you saved state.
This commit is contained in:
parent
608d716413
commit
499431c1ed
@ -697,29 +697,28 @@ void __IoDoState(PointerWrap &p) {
|
||||
}
|
||||
|
||||
for (int i = 0; i < PSP_COUNT_FDS; ++i) {
|
||||
auto clearThread = [&]() {
|
||||
if (asyncThreads[i])
|
||||
asyncThreads[i]->Forget();
|
||||
delete asyncThreads[i];
|
||||
asyncThreads[i] = nullptr;
|
||||
};
|
||||
|
||||
if (s >= 4) {
|
||||
p.DoVoid(&asyncParams[i], (int)sizeof(IoAsyncParams));
|
||||
bool hasThread = asyncThreads[i] != nullptr;
|
||||
p.Do(hasThread);
|
||||
if (hasThread) {
|
||||
if (asyncThreads[i])
|
||||
asyncThreads[i]->Forget();
|
||||
delete asyncThreads[i];
|
||||
asyncThreads[i] = nullptr;
|
||||
if (p.GetMode() == p.MODE_READ)
|
||||
clearThread();
|
||||
p.DoClass(asyncThreads[i]);
|
||||
} else if (!hasThread) {
|
||||
if (asyncThreads[i])
|
||||
asyncThreads[i]->Forget();
|
||||
delete asyncThreads[i];
|
||||
asyncThreads[i] = nullptr;
|
||||
clearThread();
|
||||
}
|
||||
} else {
|
||||
asyncParams[i].op = IoAsyncOp::NONE;
|
||||
asyncParams[i].priority = -1;
|
||||
if (asyncThreads[i])
|
||||
asyncThreads[i]->Forget();
|
||||
delete asyncThreads[i];
|
||||
asyncThreads[i] = nullptr;
|
||||
clearThread();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user