Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] gio::DataInputStream::read_upto fails because FromGlibContainer::from_glib_full_num is unimplemented #1237

Closed
luleyleo opened this issue Dec 2, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@luleyleo
Copy link

luleyleo commented Dec 2, 2023

Bug description

I wanted to read an entire file using gio::DataInputStream::read_upto but it fails when calling FromGlibContainer::from_glib_full_num here.

Backtrace

thread 'main' panicked at 'not implemented', /home/leopold/Documents/Projects/Rechner/builddir/cargo-home/registry/src/index.crates.io-6f17d22bba15001f/glib-0.18.3/src/translate.rs:2057:1
stack backtrace:
   0: rust_begin_unwind
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/panicking.rs:593:5
   1: core::panicking::panic_fmt
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/core/src/panicking.rs:67:14
   2: core::panicking::panic
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/core/src/panicking.rs:117:5
   3: <u8 as glib::translate::FromGlibContainerAsVec<u8,*const u8>>::from_glib_full_num_as_vec
             at ./cargo-home/registry/src/index.crates.io-6f17d22bba15001f/glib-0.18.3/src/translate.rs:2035:17
   4: <alloc::vec::Vec<T> as glib::translate::FromGlibContainer<P,PP>>::from_glib_full_num
             at ./cargo-home/registry/src/index.crates.io-6f17d22bba15001f/glib-0.18.3/src/translate.rs:2179:9
   5: gio::data_input_stream::DataInputStreamExtManual::read_upto
             at ./cargo-home/registry/src/index.crates.io-6f17d22bba15001f/gio-0.18.3/src/data_input_stream.rs:222:20
   6: <rechner::calculator::imp::RechnerCalculatorView as glib::subclass::object::ObjectImpl>::constructed
             at /home/leopold/Documents/Projects/Rechner/src/calculator.rs:80:29
   7: glib::subclass::object::constructed
             at ./cargo-home/registry/src/index.crates.io-6f17d22bba15001f/glib-0.18.3/src/subclass/object.rs:128:5
   8: g_object_new_internal
   9: g_object_new_with_properties
  10: glib::object::Object::new_internal
             at ./cargo-home/registry/src/index.crates.io-6f17d22bba15001f/glib-0.18.3/src/object.rs:1473:19
  11: glib::object::Object::with_mut_values
             at ./cargo-home/registry/src/index.crates.io-6f17d22bba15001f/glib-0.18.3/src/object.rs:1406:18
  12: glib::object::ObjectBuilder<O>::build
             at ./cargo-home/registry/src/index.crates.io-6f17d22bba15001f/glib-0.18.3/src/object.rs:1555:22
  13: rechner::calculator::RechnerCalculatorView::new
             at /home/leopold/Documents/Projects/Rechner/src/calculator.rs:187:9
  14: rechner::window::imp::create_page
             at /home/leopold/Documents/Projects/Rechner/src/window.rs:101:37
  15: <rechner::window::imp::RechnerWindow as glib::subclass::object::ObjectImpl>::constructed
             at /home/leopold/Documents/Projects/Rechner/src/window.rs:78:17
  16: glib::subclass::object::constructed
             at ./cargo-home/registry/src/index.crates.io-6f17d22bba15001f/glib-0.18.3/src/subclass/object.rs:128:5
  17: g_object_new_internal
  18: g_object_new_with_properties
  19: glib::object::Object::new_internal
             at ./cargo-home/registry/src/index.crates.io-6f17d22bba15001f/glib-0.18.3/src/object.rs:1473:19
  20: glib::object::Object::with_mut_values
             at ./cargo-home/registry/src/index.crates.io-6f17d22bba15001f/glib-0.18.3/src/object.rs:1406:18
  21: glib::object::ObjectBuilder<O>::build
             at ./cargo-home/registry/src/index.crates.io-6f17d22bba15001f/glib-0.18.3/src/object.rs:1555:22
  22: rechner::window::RechnerWindow::new
             at /home/leopold/Documents/Projects/Rechner/src/window.rs:153:9
  23: <rechner::application::imp::RechnerApplication as gio::subclass::application::ApplicationImpl>::activate
             at /home/leopold/Documents/Projects/Rechner/src/application.rs:61:30
  24: gio::subclass::application::application_activate
             at ./cargo-home/registry/src/index.crates.io-6f17d22bba15001f/gio-0.18.3/src/subclass/application.rs:299:5
  25: _g_closure_invoke_va
  26: signal_emit_valist_unlocked
  27: g_signal_emit_valist
  28: g_signal_emit
  29: g_application_real_local_command_line
  30: gio::subclass::application::ApplicationImplExt::parent_local_command_line
             at ./cargo-home/registry/src/index.crates.io-6f17d22bba15001f/gio-0.18.3/src/subclass/application.rs:182:23
  31: gio::subclass::application::ApplicationImpl::local_command_line
             at ./cargo-home/registry/src/index.crates.io-6f17d22bba15001f/gio-0.18.3/src/subclass/application.rs:85:9
  32: gio::subclass::application::application_local_command_line
             at ./cargo-home/registry/src/index.crates.io-6f17d22bba15001f/gio-0.18.3/src/subclass/application.rs:338:15
  33: g_application_run
  34: gio::application::ApplicationExtManual::run_with_args
             at ./cargo-home/registry/src/index.crates.io-6f17d22bba15001f/gio-0.18.3/src/application.rs:29:13
  35: gio::application::ApplicationExtManual::run
             at ./cargo-home/registry/src/index.crates.io-6f17d22bba15001f/gio-0.18.3/src/application.rs:22:9
  36: rechner::main
             at /home/leopold/Documents/Projects/Rechner/src/main.rs:55:5
  37: core::ops::function::FnOnce::call_once
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@luleyleo luleyleo added the bug Something isn't working label Dec 2, 2023
@sdroege
Copy link
Member

sdroege commented Dec 2, 2023

That can and should of course be implemented :) Do you want to provide a PR for that, or should I?

@luleyleo
Copy link
Author

luleyleo commented Dec 2, 2023

@sdroege I would have to figure out what exactly these functions are supposed to do and how any of this works first. So if you already know what to do here, I would greatly appreciate it if you could take care of this :)
If not, I can dig into this myself.

@sdroege
Copy link
Member

sdroege commented Dec 2, 2023

Sure, will do that tomorrow. I just didn't want to do it right away in case you already started

@sdroege
Copy link
Member

sdroege commented Dec 3, 2023

See #1238

@sdroege sdroege closed this as completed in d43af6a Dec 3, 2023
@luleyleo
Copy link
Author

luleyleo commented Dec 3, 2023

@sdroege Thank you!

sdroege added a commit to sdroege/gtk-rs-core that referenced this issue Dec 9, 2023
They're transfer full and need to be freed, which wouldn't be possible
for a const pointer.

Fixes gtk-rs#1237
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants