Incorrect use of `SDL_OpenURL` in SDL3 backend
Closed this issue · 2 comments
achabense commented
Version/Branch of Dear ImGui:
Version 1.92.2b
Back-ends:
imgui_impl_sdl3.cpp
Compiler, OS:
Any
Full config/build information:
No response
Details:
The following line is incorrect; should be return SDL_OpenURL(url); directly.
imgui/backends/imgui_impl_sdl3.cpp
Line 508 in b46f099
The background is Functions that previously returned a negative error code now return bool. (For SDL_OpenURL, SDL2 uses 0 on success and -1 on failure (ref), but SDL3 uses true on success and false on failure (ref).)
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
The following example will open the homepage successfully and trigger the assertion failure.
static void issue() {
static bool open = false;
if (ImGui::Begin("Control", 0, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings)) {
if (ImGui::Button("Open url")) {
if (!ImGui::GetPlatformIO().Platform_OpenInShellFn(ImGui::GetCurrentContext(),
"https://github.com/ocornut/imgui")) {
assert(false);
}
}
}
ImGui::End();
}