From b796ed86265ab6264037405b2732644617c1e72f Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Mon, 12 Feb 2024 12:33:09 +0200 Subject: [PATCH] Fix undefined behavior --- client/eventsSDL/InputHandler.cpp | 2 +- lib/ScopeGuard.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/eventsSDL/InputHandler.cpp b/client/eventsSDL/InputHandler.cpp index ae53dcf31..ae4494db4 100644 --- a/client/eventsSDL/InputHandler.cpp +++ b/client/eventsSDL/InputHandler.cpp @@ -304,7 +304,7 @@ void InputHandler::dispatchMainThread(const std::function & functor) auto heapFunctor = new std::function(functor); SDL_Event event; - event.type = SDL_USEREVENT; + event.user.type = SDL_USEREVENT; event.user.code = 0; event.user.data1 = static_cast (heapFunctor); event.user.data2 = nullptr; diff --git a/lib/ScopeGuard.h b/lib/ScopeGuard.h index bd8e0f6b5..de9b06a95 100644 --- a/lib/ScopeGuard.h +++ b/lib/ScopeGuard.h @@ -33,7 +33,7 @@ namespace vstd explicit ScopeGuard(Func && f): fire(true), - f(std::forward(f)) + f(std::move(f)) {} ~ScopeGuard() {