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

Fix having several "hand written" properties #31

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thiblahute
Copy link

We were overflowing when calculating the "generated_prop_id", let it be
negative when setting/getting a manually added property:

thread 'object_inner_methods' panicked at 'attempt to subtract with overflow', /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/ops/arith.rs:240:1
stack backtrace:
   0: rust_begin_unwind
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/panicking.rs:142:14
   2: core::panicking::panic
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/panicking.rs:48:5
   3: <usize as core::ops::arith::Sub>::sub
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/ops/arith.rs:233:45
   4: <usize as core::ops::arith::Sub<&usize>>::sub
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/internal_macros.rs:61:17
   5: <object::obj_inner::ObjInner as glib::subclass::object::ObjectImpl>::property
             at ./tests/object.rs:56:1
   6: glib::subclass::object::property
             at /var/home/thiblahute/devel/misc/gtk-rs-core/glib/src/subclass/object.rs:80:13
   7: g_object_get_property
   8: <T as glib::object::ObjectExt>::try_property_value
             at /var/home/thiblahute/devel/misc/gtk-rs-core/glib/src/object.rs:2515:13
   9: <T as glib::object::ObjectExt>::try_property
             at /var/home/thiblahute/devel/misc/gtk-rs-core/glib/src/object.rs:2485:20
  10: <T as glib::object::ObjectExt>::property
             at /var/home/thiblahute/devel/misc/gtk-rs-core/glib/src/object.rs:2493:9
  11: object::object_inner_methods
             at ./tests/object.rs:134:16
  12: object::object_inner_methods::{{closure}}
             at ./tests/object.rs:125:1
  13: core::ops::function::FnOnce::call_once
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/ops/function.rs:248:5
  14: core::ops::function::FnOnce::call_once
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

We were overflowing when calculating the "generated_prop_id", let it be
negative when setting/getting a manually added property:

```
thread 'object_inner_methods' panicked at 'attempt to subtract with overflow', /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/ops/arith.rs:240:1
stack backtrace:
   0: rust_begin_unwind
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/panicking.rs:142:14
   2: core::panicking::panic
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/panicking.rs:48:5
   3: <usize as core::ops::arith::Sub>::sub
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/ops/arith.rs:233:45
   4: <usize as core::ops::arith::Sub<&usize>>::sub
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/internal_macros.rs:61:17
   5: <object::obj_inner::ObjInner as glib::subclass::object::ObjectImpl>::property
             at ./tests/object.rs:56:1
   6: glib::subclass::object::property
             at /var/home/thiblahute/devel/misc/gtk-rs-core/glib/src/subclass/object.rs:80:13
   7: g_object_get_property
   8: <T as glib::object::ObjectExt>::try_property_value
             at /var/home/thiblahute/devel/misc/gtk-rs-core/glib/src/object.rs:2515:13
   9: <T as glib::object::ObjectExt>::try_property
             at /var/home/thiblahute/devel/misc/gtk-rs-core/glib/src/object.rs:2485:20
  10: <T as glib::object::ObjectExt>::property
             at /var/home/thiblahute/devel/misc/gtk-rs-core/glib/src/object.rs:2493:9
  11: object::object_inner_methods
             at ./tests/object.rs:134:16
  12: object::object_inner_methods::{{closure}}
             at ./tests/object.rs:125:1
  13: core::ops::function::FnOnce::call_once
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/ops/function.rs:248:5
  14: core::ops::function::FnOnce::call_once
             at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
```
@thiblahute
Copy link
Author

@jf2048 Could you check my last PRs please?

What is your plan with that project? I think it is already in very good shape and would definitely be worth having more people using it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant