Skip to content

Commit 3318088

Browse files
authored
Merge pull request #17406 from hrydgard/even-more-crash-fixes
Even more crash fixes
2 parents a291597 + 0b94ffc commit 3318088

File tree

5 files changed

+12
-3
lines changed

5 files changed

+12
-3
lines changed

Common/GPU/Vulkan/VulkanContext.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,12 @@ static std::string surface_transforms_to_string(VkSurfaceTransformFlagsKHR trans
11991199
}
12001200

12011201
bool VulkanContext::InitSwapchain() {
1202+
_assert_(physical_device_ >= 0 && physical_device_ < physical_devices_.size());
1203+
if (!surface_) {
1204+
ERROR_LOG(G3D, "VK: No surface, can't create swapchain");
1205+
return false;
1206+
}
1207+
12021208
VkResult res = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physical_devices_[physical_device_], surface_, &surfCapabilities_);
12031209
if (res == VK_ERROR_SURFACE_LOST_KHR) {
12041210
// Not much to do.

Core/FileSystems/VirtualDiscFileSystem.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ PSPFileInfo VirtualDiscFileSystem::GetFileInfo(std::string filename) {
645645
localtime_r((time_t*)&mtime, &x.mtime);
646646
}
647647

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

Core/HW/AsyncIOManager.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "Core/FileSystems/MetaFileSystem.h"
3030

3131
bool AsyncIOManager::HasOperation(u32 handle) {
32+
std::lock_guard<std::mutex> guard(resultsLock_);
3233
if (resultsPending_.find(handle) != resultsPending_.end()) {
3334
return true;
3435
}
@@ -60,6 +61,7 @@ bool AsyncIOManager::HasResult(u32 handle) {
6061
}
6162

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

7779
bool AsyncIOManager::ReadResult(u32 handle, AsyncIOResult &result) {
80+
// This is called under lock from WaitResult, no need to lock again.
7881
if (results_.find(handle) != results_.end()) {
7982
result = results_[handle];
8083
return true;

UI/GameSettingsScreen.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,7 @@ void GameSettingsScreen::dialogFinished(const Screen *dialog, DialogResult resul
14201420
}
14211421

14221422
void GameSettingsScreen::RecreateViews() {
1423-
oldSettingInfo_ = settingInfo_->GetText();
1423+
oldSettingInfo_ = settingInfo_ ? settingInfo_->GetText() : "N/A";
14241424
UIScreen::RecreateViews();
14251425
}
14261426

UI/MiscScreens.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1114,5 +1114,5 @@ void SettingInfoMessage::Draw(UIContext &dc) {
11141114
}
11151115

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

0 commit comments

Comments
 (0)