mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-01 10:01:07 +02:00
This commit is contained in:
5
.changes/fix-resource-id.md
Normal file
5
.changes/fix-resource-id.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'tauri': patch:bug
|
||||
---
|
||||
|
||||
Fixed a panic caused by an assert when the resource random id has been used already.
|
||||
@@ -111,7 +111,11 @@ impl ResourceTable {
|
||||
///
|
||||
/// Returns a unique resource ID, which acts as a key for this resource.
|
||||
pub fn add_arc_dyn(&mut self, resource: Arc<dyn Resource>) -> ResourceId {
|
||||
let rid = Self::new_random_rid();
|
||||
let mut rid = Self::new_random_rid();
|
||||
while self.index.contains_key(&rid) {
|
||||
rid = Self::new_random_rid();
|
||||
}
|
||||
|
||||
let removed_resource = self.index.insert(rid, resource);
|
||||
assert!(removed_resource.is_none());
|
||||
rid
|
||||
|
||||
Reference in New Issue
Block a user