Closed mtilda closed 1 month ago
I have also tried running the command with --features v4_10
and gotten the same result.
When I comment out these lines:
The window appears empty:
I am unsure if the squeezer
(SqueezerBin::default()
) is not mounting or if its child (Some(>k::Label::new(Some("Hello World!")))
) is not mounting. I'm pretty new to GTK, so I'm unsure how to debug this.
Setting GTK_DEBUG=all
lets me run the program with an interactive debugging window, and I can see the GtkLabel object with the value "Hello World!" that is a child of the SqueezerBin object.
Further reading: Running and debugging GTK Applications
Not sure if this is relevant, but it looks like the property GtkPicture:keep-aspect-ratio was deprecated in GTK 4.8 in favor of the new property GtkPicture:content-fit.
I do not see either of those properties documented on GtkWidget.
It makes sense to me that we are trying to define this as a custom property on SqueezerBin
, but I am not sure where we are going wrong.
I believe I have identified the reason the GtkLabel is not visible even when disabling the code that is causing errors...
SqueezerBin::size_allocate()
has a mistake:
When we call child_size
, we should be passing &child
, not &*widget
:
@@ -52,7 +52,7 @@ impl WidgetImpl for SqueezerBin {
fn size_allocate(&self, width: i32, height: i32, baseline: i32) {
let widget = self.obj();
if let Some(child) = widget.child() {
- let ((_, horizontal_size), (_, vertical_size)) = child_size(&*widget);
+ let ((_, horizontal_size), (_, vertical_size)) = child_size(&child);
let (mut horizontal_zoom, mut vertical_zoom) = (
width as f32 / horizontal_size as f32,
I will have a look in a bit
It was fixed by https://github.com/gtk-rs/gtk4-rs/pull/1760
No it wasn't actually
I am using GTK 4.10.4 on Ubuntu 23.04.
Bug description
When I clone this repo,
cd
into the directoryexamples
, and runcargo run --bin squeezer_bin
, the program panics with the following error.Backtrace
You can get the backtrace running your program with the environment variable
RUST_BACKTRACE=full
.