1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Fix remaining memory leaks caused by API misuse

This commit is contained in:
Ivan Savenko
2025-04-28 13:55:57 +03:00
parent c0fb1d1b3b
commit 554a414302
6 changed files with 17 additions and 8 deletions

View File

@@ -410,7 +410,7 @@ void InputHandler::dispatchMainThread(const std::function<void()> & functor)
SDL_Event event;
event.user.type = SDL_USEREVENT;
event.user.code = 0;
event.user.data1 = static_cast <void*>(heapFunctor.get());
event.user.data1 = nullptr;
event.user.data2 = nullptr;
SDL_PushEvent(&event);
@@ -426,9 +426,6 @@ void InputHandler::handleUserEvent(const SDL_UserEvent & current)
if (!dispatchedTasks.try_pop(task))
throw std::runtime_error("InputHandler::handleUserEvent received without active task!");
if (current.data1 != task.get())
throw std::runtime_error("InputHandler::handleUserEvent received unknown pointer!");
(*task)();
}