Skip to content

Commit 0caf5c5

Browse files
committed
Fix undefined behavior with type of WindowMan::HandleWindowExposedEvent
Undefined sanitizer's complaint: ../external/sources/SDL3-3.2.10/src/events/SDL_eventwatch.c:72:17: runtime error: call to function RTE::WindowMan::HandleWindowExposedEvent(void*, SDL_Event*) through pointer to incorrect function type 'bool (*)(void *, union SDL_Event *)' /media/ext_hdd/nobackup/architector4/Downloads/Cortex-Command-Community-Project/builddebug/../Source/Managers/WindowMan.cpp:678: note: RTE::WindowMan::HandleWindowExposedEvent(void*, SDL_Event*) defined here SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../external/sources/SDL3-3.2.10/src/events/SDL_eventwatch.c:72:17
1 parent d58b94e commit 0caf5c5

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Source/Managers/WindowMan.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,12 +675,14 @@ void WindowMan::DisplaySwitchOut() const {
675675
SDL_SetCursor(nullptr);
676676
}
677677

678-
void WindowMan::HandleWindowExposedEvent(void *userdata, SDL_Event *event) {
678+
bool WindowMan::HandleWindowExposedEvent(void *userdata, SDL_Event *event) {
679679
if (event->type == SDL_EVENT_WINDOW_EXPOSED) {
680680
g_WindowMan.SetViewportLetterboxed();
681681
g_WindowMan.ClearBackbuffer(false);
682682
g_WindowMan.UploadFrame();
683683
}
684+
685+
return true;
684686
}
685687

686688
void WindowMan::QueueWindowEvent(const SDL_Event& windowEvent) {

Source/Managers/WindowMan.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ namespace RTE {
168168
#pragma endregion
169169

170170
#pragma region Concrete Methods
171-
/// SDL_EventFilter to hadnle window exposed events for live resize.
172-
static void HandleWindowExposedEvent(void* userdata, SDL_Event* event);
171+
/// SDL_EventFilter to handle window exposed events for live resize.
172+
static bool HandleWindowExposedEvent(void* userdata, SDL_Event* event);
173173

174174
/// Adds an SDL_Event to the Event queue for processing on Update.
175175
/// @param windowEvent The SDL window event to queue.

0 commit comments

Comments
 (0)