Skip to content

Commit

Permalink
Merge pull request #11625 from phire/eventhook_nodiscard
Browse files Browse the repository at this point in the history
Fix KillRenderer config changed regression
  • Loading branch information
phire committed Mar 5, 2023
2 parents cecf2d2 + 901f12c commit 4acdbc0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Source/Core/Common/HookableEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class HookableEvent

public:
// Returns a handle that will unregister the listener when destroyed.
static EventHook Register(CallbackType callback, std::string name)
[[nodiscard]] static EventHook Register(CallbackType callback, std::string name)
{
auto& storage = GetStorage();
std::lock_guard lock(storage.m_mutex);
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/VideoCommon/AbstractGfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ std::unique_ptr<AbstractGfx> g_gfx;

AbstractGfx::AbstractGfx()
{
ConfigChangedEvent::Register([this](u32 bits) { OnConfigChanged(bits); }, "AbstractGfx");
m_config_changed =
ConfigChangedEvent::Register([this](u32 bits) { OnConfigChanged(bits); }, "AbstractGfx");
}

bool AbstractGfx::IsHeadless() const
Expand Down
4 changes: 4 additions & 0 deletions Source/Core/VideoCommon/AbstractGfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#pragma once

#include "Common/HookableEvent.h"
#include "Common/MathUtil.h"

#include "VideoCommon/RenderState.h"
Expand Down Expand Up @@ -166,6 +167,9 @@ class AbstractGfx
protected:
AbstractFramebuffer* m_current_framebuffer = nullptr;
const AbstractPipeline* m_current_pipeline = nullptr;

private:
Common::EventHook m_config_changed;
};

extern std::unique_ptr<AbstractGfx> g_gfx;

0 comments on commit 4acdbc0

Please sign in to comment.