mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-12-05 11:17:58 -05:00
Don't Crash or Stay Silent When the OpenGL Context Can't Be Activated (#17441)
* Don't Crash or Stay Silent When the OpenGL Context Can't Be Activated
When the driver refuses to make the OpenGL context current, no ImGui frame ever runs and
OpenGL is never initialized, so ImGui has no current font and the GL functions are never
loaded. A notification that measures its text from an event handler (a validation warning, a
job's progress, the slicing progress bar) then reads the null font and crashes, and once a
slice completes, loading its G-code preview calls the unloaded GL functions and crashes too.
Notifications now skip measuring until a frame has set up the font; they stay Unknown, and
render() already measures them when it draws. The G-code preview is not loaded while OpenGL
cannot be initialized; with OpenGL up, init_opengl() returns at once and nothing changes.
On Windows, a shown canvas whose context cannot be made current is reported once: wx drops the
wglMakeCurrent error in release builds, so the call is repeated to log GetLastError() with the
canvas's pixel format and the display it is on. If OpenGL never came up in the session, the
user gets one error dialog instead of an empty 3D view with no explanation. A GTK canvas can
fail until its surface is mapped, so other platforms only get the crash fixes.
* Name the Display Adapter Instead of Only Suggesting a Driver Upgrade When OpenGL Can't Be Activated
A context that can't be made current has several causes: no OpenGL driver
behind the display the window is on (a disabled adapter, or one running on
the Microsoft Basic Display Adapter), a broken driver, or an overlay. The old
advice to upgrade the driver covered only one of them. The dialog now names
the adapter Windows reports for the window's display and lists the general
checks, and the log line keeps the display device and adapter name.
(cherry picked from commit 3c72223aaf)
This commit is contained in:
1 parent
8eb8230a8c
commit
5f243f93ba
5 files changed
+120
-1
No files matched your search
@@ -850,6 +850,9 @@ void NotificationManager::HintNotification::init()
|
||||
// Do not init closing notification
|
||||
if (is_finished())
|
||||
return;
|
||||
// No font before the first ImGui frame, see PopNotification::init().
|
||||
if (ImGui::GetFont() == nullptr)
|
||||
return;
|
||||
|
||||
count_spaces();
|
||||
count_lines();
|
||||
|
||||
Reference in new issue
Block a user