pop-os / libcosmic

WIP library for COSMIC applications
https://pop-os.github.io/libcosmic/cosmic/
Mozilla Public License 2.0
427 stars 41 forks source link

bug: diff method crashing applications. #480

Closed edfloreshz closed 4 months ago

edfloreshz commented 4 months ago

There appears to be an issue with the diff method for the widgets, it's crashing applications, I've tested this with cosmic-backups and cosmic-tasks.

thread 'main' panicked at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/core/src/widget/tree.rs:188:25:
assertion failed: old.id == new.id
stack backtrace:
   0:     0x5643f054c886 - std::backtrace_rs::backtrace::libunwind::trace::h92ba5ac126ecc5ad
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x5643f054c886 - std::backtrace_rs::backtrace::trace_unsynchronized::hfaa118b6e3a8f31a
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x5643f054c886 - std::sys_common::backtrace::_print_fmt::h2075f185adf13bbd
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x5643f054c886 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h9c4bd387f9f3f544
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x5643f057e7f0 - core::fmt::rt::Argument::fmt::h018ecebdf268b5bb
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/fmt/rt.rs:142:9
   5:     0x5643f057e7f0 - core::fmt::write::h938c332fdab924eb
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/fmt/mod.rs:1120:17
   6:     0x5643f054806f - std::io::Write::write_fmt::h4a694b02e44e6363
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/io/mod.rs:1846:15
   7:     0x5643f054c664 - std::sys_common::backtrace::_print::h3595c0f4303f3ccd
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x5643f054c664 - std::sys_common::backtrace::print::ha888e6736b0bc71f
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x5643f054e077 - std::panicking::default_hook::{{closure}}::he19a7f79f7beab5e
  10:     0x5643f054ddd9 - std::panicking::default_hook::h67efe04e9a5d446e
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/panicking.rs:292:9
  11:     0x5643f054e508 - std::panicking::rust_panic_with_hook::h49021cdbc4b22349
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/panicking.rs:781:13
  12:     0x5643f054e3a9 - std::panicking::begin_panic_handler::{{closure}}::hfbf601f3d8c62d13
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/panicking.rs:651:13
  13:     0x5643f054cd86 - std::sys_common::backtrace::__rust_end_short_backtrace::h98dd020b6e913806
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/sys_common/backtrace.rs:171:18
  14:     0x5643f054e134 - rust_begin_unwind
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/panicking.rs:647:5
  15:     0x5643ec559cb5 - core::panicking::panic_fmt::h0d3f1893e38be419
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/panicking.rs:72:14
  16:     0x5643ec559d73 - core::panicking::panic::h59297120e85ea178
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/panicking.rs:144:5
  17:     0x5643ec7575ee - iced_core::widget::tree::Tree::diff::h8b386fbb9360ef06
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/core/src/widget/tree.rs:188:25
  18:     0x5643ec7510df - iced_core::widget::tree::Tree::diff_children::{{closure}}::h20b35efcad7f6773
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/core/src/widget/tree.rs:229:17
  19:     0x5643ec7525e9 - iced_core::widget::tree::Tree::diff_children_custom::h5272ad78a565bc5b
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/core/src/widget/tree.rs:306:13
  20:     0x5643ec750f30 - iced_core::widget::tree::Tree::diff_children::hb3027e9b8ab3bca6
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/core/src/widget/tree.rs:224:9
  21:     0x5643ec78a803 - <iced_widget::row::Row<Message,Theme,Renderer> as iced_core::widget::Widget<Message,Theme,Renderer>>::diff::h5fa6071c6812843e
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/widget/src/row.rs:123:9
  22:     0x5643ec938865 - <iced_widget::container::Container<Message,Theme,Renderer> as iced_core::widget::Widget<Message,Theme,Renderer>>::diff::h74f7a7835ff667b1
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/widget/src/container.rs:149:9
  23:     0x5643ec758911 - iced_core::widget::tree::Tree::diff::h8c9981f938e552c8
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/core/src/widget/tree.rs:211:13
  24:     0x5643ec865ef5 - <cosmic::widget::id_container::IdContainer<Message,Theme,Renderer> as iced_core::widget::Widget<Message,Theme,Renderer>>::diff::he8e65f6d91980e52
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/src/widget/id_container.rs:60:9
  25:     0x5643ec757b23 - iced_core::widget::tree::Tree::diff::h8b386fbb9360ef06
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/core/src/widget/tree.rs:211:13
  26:     0x5643ec7510df - iced_core::widget::tree::Tree::diff_children::{{closure}}::h20b35efcad7f6773
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/core/src/widget/tree.rs:229:17
  27:     0x5643ec7525e9 - iced_core::widget::tree::Tree::diff_children_custom::h5272ad78a565bc5b
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/core/src/widget/tree.rs:306:13
  28:     0x5643ec750f30 - iced_core::widget::tree::Tree::diff_children::hb3027e9b8ab3bca6
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/core/src/widget/tree.rs:224:9
  29:     0x5643ec5c7eb3 - <iced_widget::column::Column<Message,Theme,Renderer> as iced_core::widget::Widget<Message,Theme,Renderer>>::diff::h6960e1583474ec06
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/widget/src/column.rs:132:9
  30:     0x5643ec757b23 - iced_core::widget::tree::Tree::diff::h8b386fbb9360ef06
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/core/src/widget/tree.rs:211:13
  31:     0x5643ec7512ef - iced_core::widget::tree::Tree::diff_children::{{closure}}::h8a3e9e02e93434d7
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/core/src/widget/tree.rs:229:17
  32:     0x5643ec753ae9 - iced_core::widget::tree::Tree::diff_children_custom::hf3f61e8ae7833ee7
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/core/src/widget/tree.rs:306:13
  33:     0x5643ec750fb0 - iced_core::widget::tree::Tree::diff_children::hbaff7547cb1c6d24
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/core/src/widget/tree.rs:224:9
  34:     0x5643ec733001 - <cosmic::widget::popover::Popover<Message,Renderer> as iced_core::widget::Widget<Message,cosmic::theme::Theme,Renderer>>::diff::h65469dcdb46858c5
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/src/widget/popover.rs:97:13
  35:     0x5643ec757b23 - iced_core::widget::tree::Tree::diff::h8b386fbb9360ef06
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/core/src/widget/tree.rs:211:13
  36:     0x5643ec852638 - iced_runtime::user_interface::UserInterface<Message,Theme,Renderer>::build::h5a432f4ef8092f07
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/runtime/src/user_interface.rs:108:9
  37:     0x5643ec74dae0 - iced_winit::multi_window::build_user_interface::h57802af98cfd5a06
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/winit/src/multi_window.rs:1280:26
  38:     0x5643ec74def8 - iced_winit::multi_window::build_user_interfaces::{{closure}}::ha99d542750e05cec
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/winit/src/multi_window.rs:1744:29
  39:     0x5643ec964607 - core::iter::adapters::filter_map::filter_map_fold::{{closure}}::hf08690aee6d3c1ab
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/iter/adapters/filter_map.rs:38:28
  40:     0x5643ec8680fa - core::iter::traits::iterator::Iterator::fold::hda031391f6f4dda3
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/iter/traits/iterator.rs:2640:21
  41:     0x5643ec981694 - <hashbrown::map::Drain<K,V,A> as core::iter::traits::iterator::Iterator>::fold::h03733d4358fc3a1c
                               at /rust/deps/hashbrown-0.14.3/src/map.rs:4965:9
  42:     0x5643ec981694 - <std::collections::hash::map::Drain<K,V> as core::iter::traits::iterator::Iterator>::fold::hc1a01e2ddb04ca47
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/collections/hash/map.rs:2564:19
  43:     0x5643ec963151 - <core::iter::adapters::filter_map::FilterMap<I,F> as core::iter::traits::iterator::Iterator>::fold::h14574d6cacbf8b8f
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/iter/adapters/filter_map.rs:148:9
  44:     0x5643ec964578 - core::iter::traits::iterator::Iterator::for_each::ha80ffbb108943fb4
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/iter/traits/iterator.rs:858:9
  45:     0x5643ec5a1367 - <hashbrown::map::HashMap<K,V,S,A> as core::iter::traits::collect::Extend<(K,V)>>::extend::he8d7e376d97c1bac
                               at /rust/deps/hashbrown-0.14.3/src/map.rs:6511:9
  46:     0x5643ec981a98 - <std::collections::hash::map::HashMap<K,V,S> as core::iter::traits::collect::Extend<(K,V)>>::extend::h18cd13a55696a4e3
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/collections/hash/map.rs:3142:9
  47:     0x5643ec981a98 - <std::collections::hash::map::HashMap<K,V,S> as core::iter::traits::collect::FromIterator<(K,V)>>::from_iter::h5473e33d85e542b2
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/collections/hash/map.rs:3127:13
  48:     0x5643ec96417d - core::iter::traits::iterator::Iterator::collect::h11e6bf24eab0ef2a
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/iter/traits/iterator.rs:2054:9
  49:     0x5643ec74dc63 - iced_winit::multi_window::build_user_interfaces::h85eef3dd8bdbc599
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/winit/src/multi_window.rs:1740:5
  50:     0x5643ec74b395 - iced_winit::multi_window::run_instance::{{closure}}::h4154acea8a4a6e6f
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/winit/src/multi_window.rs:866:51
  51:     0x5643ec74fd70 - iced_winit::multi_window::run::{{closure}}::heac1fe11eb02df9d
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/winit/src/multi_window.rs:252:24
  52:     0x5643ec7509fd - core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut::hdc5ad876803503a1
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/ops/function.rs:294:13
  53:     0x5643ec75099d - core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut::ha26ef3c55b3805f1
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/ops/function.rs:294:13
  54:     0x5643ec9d459b - winit::platform_impl::platform::wayland::event_loop::EventLoop<T>::single_iteration::ha8e0722dab5ec9c4
                               at /home/eduardo/.cargo/git/checkouts/winit-40d7deb2b0c08730/bdc6610/src/platform_impl/linux/wayland/event_loop/mod.rs:520:9
  55:     0x5643ec9d885c - winit::platform_impl::platform::wayland::event_loop::EventLoop<T>::poll_events_with_timeout::hf520ea13325225e5
                               at /home/eduardo/.cargo/git/checkouts/winit-40d7deb2b0c08730/bdc6610/src/platform_impl/linux/wayland/event_loop/mod.rs:323:9
  56:     0x5643ec9d345f - winit::platform_impl::platform::wayland::event_loop::EventLoop<T>::pump_events::h8fccee2444a2bb77
                               at /home/eduardo/.cargo/git/checkouts/winit-40d7deb2b0c08730/bdc6610/src/platform_impl/linux/wayland/event_loop/mod.rs:237:13
  57:     0x5643ec9d3955 - winit::platform_impl::platform::wayland::event_loop::EventLoop<T>::run_on_demand::hf8bd5116f8572a2c
                               at /home/eduardo/.cargo/git/checkouts/winit-40d7deb2b0c08730/bdc6610/src/platform_impl/linux/wayland/event_loop/mod.rs:201:19
  58:     0x5643ec7a0212 - winit::platform_impl::platform::EventLoop<T>::run_on_demand::h61b0df66171de248
                               at /home/eduardo/.cargo/git/checkouts/winit-40d7deb2b0c08730/bdc6610/src/platform_impl/linux/mod.rs:821:56
  59:     0x5643ec7a09b6 - winit::platform_impl::platform::EventLoop<T>::run::h58776c22acc659f7
                               at /home/eduardo/.cargo/git/checkouts/winit-40d7deb2b0c08730/bdc6610/src/platform_impl/linux/mod.rs:814:9
  60:     0x5643ec5e0979 - winit::event_loop::EventLoop<T>::run::hcf031cfc788311cc
                               at /home/eduardo/.cargo/git/checkouts/winit-40d7deb2b0c08730/bdc6610/src/event_loop.rs:249:9
  61:     0x5643ec74f669 - iced_winit::multi_window::run::hc80bd0c35dae7756
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/winit/src/multi_window.rs:242:13
  62:     0x5643ec7b212c - iced::multi_window::application::Application::run::h4e47633535fef751
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/iced/src/multi_window/application.rs:185:12
  63:     0x5643eca1e938 - cosmic::app::run::hdbc23aa0c9817122
                               at /home/eduardo/.cargo/git/checkouts/libcosmic-b367e32ffc370f4f/e1b78fd/src/app/mod.rs:164:5
  64:     0x5643ec83ae2e - cosmic_backups::main::h416e8a218045c0f6
                               at /home/eduardo/Developer/GitHub/ahoneybun/cosmic-backups/src/main.rs:18:5
  65:     0x5643ec8dc972 - core::ops::function::FnOnce::call_once::h1b30962ce829bd04
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/ops/function.rs:250:5
  66:     0x5643ec7c67f5 - std::sys_common::backtrace::__rust_begin_short_backtrace::h8e96d0691516d9f8
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/sys_common/backtrace.rs:155:18
  67:     0x5643ec720e76 - std::rt::lang_start::{{closure}}::h23abbcc00a2f6921
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/rt.rs:166:18
  68:     0x5643f053e8e1 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::he2501730d3d7649e
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/core/src/ops/function.rs:284:13
  69:     0x5643f053e8e1 - std::panicking::try::do_call::h900df580cee6b404
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/panicking.rs:554:40
  70:     0x5643f053e8e1 - std::panicking::try::h2835d399792b43db
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/panicking.rs:518:19
  71:     0x5643f053e8e1 - std::panic::catch_unwind::hdff7b6e6c35776df
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/panic.rs:142:14
  72:     0x5643f053e8e1 - std::rt::lang_start_internal::{{closure}}::h6f12a67e0af11221
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/rt.rs:148:48
  73:     0x5643f053e8e1 - std::panicking::try::do_call::h226d8232820746bf
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/panicking.rs:554:40
  74:     0x5643f053e8e1 - std::panicking::try::h7a70dd2f0620aaac
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/panicking.rs:518:19
  75:     0x5643f053e8e1 - std::panic::catch_unwind::h4827d3381ec3b157
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/panic.rs:142:14
  76:     0x5643f053e8e1 - std::rt::lang_start_internal::hc3f700406209db2c
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/rt.rs:148:20
  77:     0x5643ec720e4a - std::rt::lang_start::h908e733365216442
                               at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/rt.rs:165:17
  78:     0x5643ec83aece - main
  79:     0x7ff14a388088 - __libc_start_call_main
  80:     0x7ff14a38814b - __libc_start_main_impl
  81:     0x5643ec55a6b5 - _start
  82:                0x0 - <unknown>
wash2 commented 4 months ago

The panic is caused by a recently added debug assert added to make sure the internal state management logic is correct. I'll do some debugging with the applications you shared.

edfloreshz commented 4 months ago

Let me know if I can be of assistance.

wash2 commented 4 months ago

Ok, I'm going to replace the debug_assert statements with a check that just skips values that don't match instead. And the ID check needs to be changed a bit to only check the structure of the internal ID, not that it's an exact match.