@@ -94,6 +94,7 @@ use std::{
9494 fmt,
9595 ops:: Deref ,
9696 path:: PathBuf ,
97+ rc:: Rc ,
9798 sync:: {
9899 mpsc:: { channel, Sender } ,
99100 Arc , Mutex , Weak ,
@@ -227,7 +228,7 @@ impl<T: UserEvent> Context<T> {
227228pub struct DispatcherMainThreadContext < T : UserEvent > {
228229 pub window_target : EventLoopWindowTarget < Message < T > > ,
229230 pub web_context : WebContextStore ,
230- pub windows : Arc < RefCell < HashMap < WebviewId , WindowWrapper > > > ,
231+ pub windows : Rc < RefCell < HashMap < WebviewId , WindowWrapper > > > ,
231232}
232233
233234impl < T : UserEvent > std:: fmt:: Debug for DispatcherMainThreadContext < T > {
@@ -1544,7 +1545,7 @@ impl<T: UserEvent> Dispatch<T> for WryDispatcher<T> {
15441545#[ derive( Clone ) ]
15451546enum WindowHandle {
15461547 Webview {
1547- inner : Arc < WebView > ,
1548+ inner : Rc < WebView > ,
15481549 context_store : WebContextStore ,
15491550 // the key of the WebContext if it's not shared
15501551 context_key : Option < PathBuf > ,
@@ -1560,7 +1561,7 @@ impl Drop for WindowHandle {
15601561 context_key,
15611562 } = self
15621563 {
1563- if Arc :: get_mut ( inner) . is_some ( ) {
1564+ if Rc :: get_mut ( inner) . is_some ( ) {
15641565 context_store. lock ( ) . unwrap ( ) . remove ( context_key) ;
15651566 }
15661567 }
@@ -1816,7 +1817,7 @@ impl<T: UserEvent> Wry<T> {
18161817 let main_thread_id = current_thread ( ) . id ( ) ;
18171818 let web_context = WebContextStore :: default ( ) ;
18181819
1819- let windows = Arc :: new ( RefCell :: new ( HashMap :: default ( ) ) ) ;
1820+ let windows = Rc :: new ( RefCell :: new ( HashMap :: default ( ) ) ) ;
18201821 let webview_id_map = WebviewIdStore :: default ( ) ;
18211822
18221823 let context = Context {
@@ -2056,11 +2057,11 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
20562057pub struct EventLoopIterationContext < ' a , T : UserEvent > {
20572058 pub callback : & ' a mut ( dyn FnMut ( RunEvent < T > ) + ' static ) ,
20582059 pub webview_id_map : WebviewIdStore ,
2059- pub windows : Arc < RefCell < HashMap < WebviewId , WindowWrapper > > > ,
2060+ pub windows : Rc < RefCell < HashMap < WebviewId , WindowWrapper > > > ,
20602061}
20612062
20622063struct UserMessageContext {
2063- windows : Arc < RefCell < HashMap < WebviewId , WindowWrapper > > > ,
2064+ windows : Rc < RefCell < HashMap < WebviewId , WindowWrapper > > > ,
20642065 webview_id_map : WebviewIdStore ,
20652066}
20662067
@@ -2529,7 +2530,7 @@ fn handle_event_loop<T: UserEvent>(
25292530fn on_close_requested < ' a , T : UserEvent > (
25302531 callback : & ' a mut ( dyn FnMut ( RunEvent < T > ) + ' static ) ,
25312532 window_id : WebviewId ,
2532- windows : Arc < RefCell < HashMap < WebviewId , WindowWrapper > > > ,
2533+ windows : Rc < RefCell < HashMap < WebviewId , WindowWrapper > > > ,
25332534) {
25342535 let ( tx, rx) = channel ( ) ;
25352536 let windows_ref = windows. borrow ( ) ;
@@ -2557,7 +2558,7 @@ fn on_close_requested<'a, T: UserEvent>(
25572558 }
25582559}
25592560
2560- fn on_window_close ( window_id : WebviewId , windows : Arc < RefCell < HashMap < WebviewId , WindowWrapper > > > ) {
2561+ fn on_window_close ( window_id : WebviewId , windows : Rc < RefCell < HashMap < WebviewId , WindowWrapper > > > ) {
25612562 if let Some ( window_wrapper) = windows. borrow_mut ( ) . get_mut ( & window_id) {
25622563 window_wrapper. inner = None ;
25632564 }
@@ -2803,7 +2804,7 @@ fn create_webview<T: UserEvent, F: Fn(RawWindow) + Send + 'static>(
28032804 Ok ( WindowWrapper {
28042805 label,
28052806 inner : Some ( WindowHandle :: Webview {
2806- inner : Arc :: new ( webview) ,
2807+ inner : Rc :: new ( webview) ,
28072808 context_store : web_context_store. clone ( ) ,
28082809 context_key : if automation_enabled {
28092810 None
0 commit comments