karl-zylinski / odin-raylib-hot-reload-game-template

An Odin + Raylib game template with Hot Reloading pre-setup
MIT License
229 stars 21 forks source link

Removed redundant os.close call from the end of main_release #3

Closed alfredbaudisch closed 7 months ago

alfredbaudisch commented 7 months ago

Removes the os.close(logh) call at the end of main_release.odin.

main_release.odin currently calls:

log.destroy_file_logger(&logger)
os.close(logh)

But destroy_file_logger already closes the file handle:

destroy_file_logger :: proc(log: ^Logger) {
    data := cast(^File_Console_Logger_Data)log.data
    if data.file_handle != os.INVALID_HANDLE {
        os.close(data.file_handle) <-------------------------
    }
    free(data)
}

The extra call os.close(logh) is crashing the application upon being closed:

game_debug.exe: An invalid handle was specified.

image

karl-zylinski commented 7 months ago

Thank you!