Skip to content

Commit

Permalink
Merge pull request #726 from jasonrhansen/dialog-subscriptions
Browse files Browse the repository at this point in the history
Fix crash for dialog in debug mode
  • Loading branch information
jackpot51 authored Jan 6, 2025
2 parents 02a96ba + 76a3dd6 commit 792c640
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ impl<M: Send + 'static> Dialog<M> {
self.cosmic
.subscription()
.map(DialogMessage)
.map(self.mapper)
.with(self.mapper)
.map(|(mapper, message)| mapper(message))
}

pub fn update(&mut self, message: DialogMessage) -> Task<M> {
Expand Down Expand Up @@ -1709,16 +1710,17 @@ impl Application for App {
];

for (key, mounter) in MOUNTERS.iter() {
let key = *key;
subscriptions.push(mounter.subscription().map(move |mounter_message| {
match mounter_message {
MounterMessage::Items(items) => Message::MounterItems(key, items),
_ => {
log::warn!("{:?} not supported in dialog mode", mounter_message);
Message::None
}
}
}));
subscriptions.push(
mounter.subscription().with(*key).map(
|(key, mounter_message)| match mounter_message {
MounterMessage::Items(items) => Message::MounterItems(key, items),
_ => {
log::warn!("{:?} not supported in dialog mode", mounter_message);
Message::None
}
},
),
);
}

Subscription::batch(subscriptions)
Expand Down

0 comments on commit 792c640

Please sign in to comment.