[Kernel] XThread: Added mutex to set_name.
There is a small chance that game will spam requests for thread name change which will cause invalid free
This commit is contained in:
@@ -136,6 +136,7 @@ void XThread::set_last_error(uint32_t error_code) {
|
||||
}
|
||||
|
||||
void XThread::set_name(const std::string_view name) {
|
||||
std::lock_guard<std::mutex> lock(thread_lock_);
|
||||
thread_name_ = fmt::format("{} ({:08X})", name, handle());
|
||||
|
||||
if (thread_) {
|
||||
|
||||
@@ -465,6 +465,8 @@ class XThread : public XObject, public cpu::Thread {
|
||||
bool running_ = false;
|
||||
|
||||
int32_t priority_ = 0;
|
||||
|
||||
std::mutex thread_lock_;
|
||||
};
|
||||
|
||||
class XHostThread : public XThread {
|
||||
|
||||
Reference in New Issue
Block a user