Browse Source

Fix undefined behavior

Ivan Savenko 1 year ago
parent
commit
b796ed8626
2 changed files with 2 additions and 2 deletions
  1. 1 1
      client/eventsSDL/InputHandler.cpp
  2. 1 1
      lib/ScopeGuard.h

+ 1 - 1
client/eventsSDL/InputHandler.cpp

@@ -304,7 +304,7 @@ void InputHandler::dispatchMainThread(const std::function<void()> & functor)
 	auto heapFunctor = new std::function<void()>(functor);
 
 	SDL_Event event;
-	event.type = SDL_USEREVENT;
+	event.user.type = SDL_USEREVENT;
 	event.user.code = 0;
 	event.user.data1 = static_cast <void*>(heapFunctor);
 	event.user.data2 = nullptr;

+ 1 - 1
lib/ScopeGuard.h

@@ -33,7 +33,7 @@ namespace vstd
 
 		explicit ScopeGuard(Func && f):
 			fire(true),
-			f(std::forward<Func>(f))
+			f(std::move(f))
 		{}
 		~ScopeGuard()
 		{