Skip to content

Commit

Permalink
Fix rare crash (#6251)
Browse files Browse the repository at this point in the history
Remove an `unwrap()` that sometimes caused crashes.

Found with `scripts/fetch_crashes.py` (analytics)

* See #3408

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using examples from latest `main` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/6251?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/6251?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!

- [PR Build Summary](https://build.rerun.io/pr/6251)
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

To run all checks from `main`, comment on the PR with `@rerun-bot
full-check`.
  • Loading branch information
emilk authored May 8, 2024
1 parent 61193fd commit bda1db0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/re_smart_channel/src/sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ impl<T: Send> Sender<T> {
Arc::clone(&self.source),
SmartMessagePayload::Msg(msg),
)
.map_err(|SendError(msg)| match msg {
SmartMessagePayload::Msg(msg) => SendError(msg),
SmartMessagePayload::Quit(_) => unreachable!(),
})
}

/// Forwards a message as-is.
Expand All @@ -43,7 +47,7 @@ impl<T: Send> Sender<T> {
time: Instant,
source: Arc<SmartMessageSource>,
payload: SmartMessagePayload<T>,
) -> Result<(), SendError<T>> {
) -> Result<(), SendError<SmartMessagePayload<T>>> {
// NOTE: We should never be sending a message with an unknown source.
debug_assert!(!matches!(*source, SmartMessageSource::Unknown));

Expand All @@ -53,7 +57,7 @@ impl<T: Send> Sender<T> {
source,
payload,
})
.map_err(|SendError(msg)| SendError(msg.into_data().unwrap()))
.map_err(|SendError(msg)| SendError(msg.payload))
}

/// Used to indicate that a sender has left.
Expand Down

0 comments on commit bda1db0

Please sign in to comment.