Skip to content

Conversation

yvt
Copy link
Contributor

@yvt yvt commented Oct 5, 2025

Fixes GL context creation failure causing a panic (if debug assertions are enabled) or UB (otherwise).

thread 'main' panicked at /home/USER/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gdk4-0.10.1/src/auto/gl_context.rs:18:1:
assertion failed: !ptr.is_null()
stack backtrace:
   0: __rustc::rust_begin_unwind
             at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/panicking.rs:697:5
   1: core::panicking::panic_fmt
             at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/core/src/panicking.rs:75:14
   2: core::panicking::panic
             at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/core/src/panicking.rs:145:5
   3: <gdk4::auto::gl_context::GLContext as glib::translate::FromGlibPtrNone<*mut gdk4_sys::GdkGLContext>>::from_glib_none
             at /home/USER/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/glib-0.21.3/src/object.rs:899:17
   4: glib::translate::from_glib_none
             at /home/USER/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/glib-0.21.3/src/translate.rs:1630:5
   5: gtk4::subclass::gl_area::GLAreaImplExt::parent_create_context
             at /home/USER/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gtk4-0.10.1/src/subclass/gl_area.rs:33:29
   6: gtk4::subclass::gl_area::GLAreaImpl::create_context
             at /home/USER/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gtk4-0.10.1/src/subclass/gl_area.rs:14:14
   7: gtk4::subclass::gl_area::gl_area_create_context
             at /home/USER/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gtk4-0.10.1/src/subclass/gl_area.rs:91:9

@yvt yvt requested a review from bilelmoussaoui as a code owner October 5, 2025 09:55
@bilelmoussaoui bilelmoussaoui merged commit 26dbe02 into gtk-rs:main Oct 5, 2025
39 of 41 checks passed
@yvt yvt deleted the fix-gtk4-subclass-glarea-null-context branch October 5, 2025 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants