Skip to content

Commit

Permalink
Merge pull request #17406 from hrydgard/even-more-crash-fixes
Browse files Browse the repository at this point in the history
Even more crash fixes
  • Loading branch information
hrydgard committed May 5, 2023
2 parents a291597 + 0b94ffc commit 3318088
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions Common/GPU/Vulkan/VulkanContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1199,6 +1199,12 @@ static std::string surface_transforms_to_string(VkSurfaceTransformFlagsKHR trans
}

bool VulkanContext::InitSwapchain() {
_assert_(physical_device_ >= 0 && physical_device_ < physical_devices_.size());
if (!surface_) {
ERROR_LOG(G3D, "VK: No surface, can't create swapchain");
return false;
}

VkResult res = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physical_devices_[physical_device_], surface_, &surfCapabilities_);
if (res == VK_ERROR_SURFACE_LOST_KHR) {
// Not much to do.
Expand Down
2 changes: 1 addition & 1 deletion Core/FileSystems/VirtualDiscFileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ PSPFileInfo VirtualDiscFileSystem::GetFileInfo(std::string filename) {
localtime_r((time_t*)&mtime, &x.mtime);
}

x.startSector = fileList[fileIndex].firstBlock;
// x.startSector was set above in "if (fileIndex != -1)".
x.numSectors = (x.size+2047)/2048;
}

Expand Down
3 changes: 3 additions & 0 deletions Core/HW/AsyncIOManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "Core/FileSystems/MetaFileSystem.h"

bool AsyncIOManager::HasOperation(u32 handle) {
std::lock_guard<std::mutex> guard(resultsLock_);
if (resultsPending_.find(handle) != resultsPending_.end()) {
return true;
}
Expand Down Expand Up @@ -60,6 +61,7 @@ bool AsyncIOManager::HasResult(u32 handle) {
}

bool AsyncIOManager::PopResult(u32 handle, AsyncIOResult &result) {
// This is called under lock from WaitResult, no need to lock again.
if (results_.find(handle) != results_.end()) {
result = results_[handle];
results_.erase(handle);
Expand All @@ -75,6 +77,7 @@ bool AsyncIOManager::PopResult(u32 handle, AsyncIOResult &result) {
}

bool AsyncIOManager::ReadResult(u32 handle, AsyncIOResult &result) {
// This is called under lock from WaitResult, no need to lock again.
if (results_.find(handle) != results_.end()) {
result = results_[handle];
return true;
Expand Down
2 changes: 1 addition & 1 deletion UI/GameSettingsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@ void GameSettingsScreen::dialogFinished(const Screen *dialog, DialogResult resul
}

void GameSettingsScreen::RecreateViews() {
oldSettingInfo_ = settingInfo_->GetText();
oldSettingInfo_ = settingInfo_ ? settingInfo_->GetText() : "N/A";
UIScreen::RecreateViews();
}

Expand Down
2 changes: 1 addition & 1 deletion UI/MiscScreens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1114,5 +1114,5 @@ void SettingInfoMessage::Draw(UIContext &dc) {
}

std::string SettingInfoMessage::GetText() const {
return showing_ && text_ ? text_->GetText() : "";
return (showing_ && text_) ? text_->GetText() : "";
}

0 comments on commit 3318088

Please sign in to comment.