Skip to content

Commit

Permalink
Merge pull request hrydgard#12740 from unknownbrackets/font-minor
Browse files Browse the repository at this point in the history
Font: Prevent crash on game exit
  • Loading branch information
hrydgard authored Mar 21, 2020
2 parents 9998177 + 000a166 commit 0d2acb6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Core/HLE/sceFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,9 @@ class FontLib {
u32 args[2] = { params_.userDataAddr, (u32)handle_ };
// TODO: The return value of this is leaking.
if (handle_) { // Avoid calling free-callback on double-free
__KernelDirectMipsCall(params_.freeFuncAddr, 0, args, 2, false);
if (coreState != CORE_POWERDOWN) {
__KernelDirectMipsCall(params_.freeFuncAddr, 0, args, 2, false);
}
}
handle_ = 0;
fonts_.clear();
Expand Down Expand Up @@ -628,7 +630,7 @@ class FontLib {
for (size_t i = 0; i < fonts_.size(); i++) {
if (fonts_[i] == font->Handle()) {
isfontopen_[i] = 0;
if (openAllocatedAddresses_[i] != 0) {
if (openAllocatedAddresses_[i] != 0 && coreState != CORE_POWERDOWN) {
u32 args[2] = { userDataAddr(), openAllocatedAddresses_[i] };
__KernelDirectMipsCall(freeFuncAddr(), 0, args, 2, true);
openAllocatedAddresses_[i] = 0;
Expand All @@ -641,7 +643,7 @@ class FontLib {
}

void flushFont() {
if (charInfoBitmapAddress_ != 0) {
if (charInfoBitmapAddress_ != 0 && coreState != CORE_POWERDOWN) {
u32 args[2] = { userDataAddr(), charInfoBitmapAddress_ };
__KernelDirectMipsCall(freeFuncAddr(), 0, args, 2, true);
charInfoBitmapAddress_ = 0;
Expand Down

0 comments on commit 0d2acb6

Please sign in to comment.