File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " tauri " : patch
3+ ---
4+
5+ Enfore uniqueness of window label.
Original file line number Diff line number Diff line change @@ -17,6 +17,9 @@ pub enum Error {
1717 /// Failed to create window.
1818 #[ error( "failed to create window" ) ]
1919 CreateWindow ,
20+ /// Window label must be unique.
21+ #[ error( "a window with label `{0}` already exists" ) ]
22+ WindowLabelAlreadyExists ( String ) ,
2023 /// Can't access webview dispatcher because the webview was closed or not found.
2124 #[ error( "webview not found: invalid label or it was closed" ) ]
2225 WebviewNotFound ,
Original file line number Diff line number Diff line change @@ -658,6 +658,11 @@ impl<P: Params> WindowManager<P> {
658658 mut pending : PendingWindow < P > ,
659659 pending_labels : & [ P :: Label ] ,
660660 ) -> crate :: Result < PendingWindow < P > > {
661+ if self . windows_lock ( ) . contains_key ( & pending. label ) {
662+ return Err ( crate :: Error :: WindowLabelAlreadyExists (
663+ pending. label . to_string ( ) ,
664+ ) ) ;
665+ }
661666 let ( is_local, url) = match & pending. webview_attributes . url {
662667 WindowUrl :: App ( path) => {
663668 let url = self . get_url ( ) ;
You can’t perform that action at this time.
0 commit comments