Fix Widget::tag implementation of pure::Canvas
Using `P::State` can cause a panic if the `Canvas` has `()` as `P::State` and replaces a stateless widget in a future `view` call.
This commit is contained in:
parent
799a7e501d
commit
9330a83775
2 changed files with 3 additions and 3 deletions
|
|
@ -109,7 +109,8 @@ where
|
||||||
B: Backend,
|
B: Backend,
|
||||||
{
|
{
|
||||||
fn tag(&self) -> tree::Tag {
|
fn tag(&self) -> tree::Tag {
|
||||||
tree::Tag::of::<P::State>()
|
struct Tag<T>(T);
|
||||||
|
tree::Tag::of::<Tag<P::State>>()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn state(&self) -> tree::State {
|
fn state(&self) -> tree::State {
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,6 @@ where
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Tag<T>(T);
|
|
||||||
|
|
||||||
struct Instance<'a, Message, Renderer, Event, S> {
|
struct Instance<'a, Message, Renderer, Event, S> {
|
||||||
state: RefCell<Option<State<'a, Message, Renderer, Event, S>>>,
|
state: RefCell<Option<State<'a, Message, Renderer, Event, S>>>,
|
||||||
}
|
}
|
||||||
|
|
@ -132,6 +130,7 @@ where
|
||||||
Renderer: iced_native::Renderer,
|
Renderer: iced_native::Renderer,
|
||||||
{
|
{
|
||||||
fn tag(&self) -> tree::Tag {
|
fn tag(&self) -> tree::Tag {
|
||||||
|
struct Tag<T>(T);
|
||||||
tree::Tag::of::<Tag<S>>()
|
tree::Tag::of::<Tag<S>>()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue