|
@@ -93,7 +93,7 @@ use std::{
|
|
sync::{
|
|
sync::{
|
|
atomic::{AtomicBool, Ordering},
|
|
atomic::{AtomicBool, Ordering},
|
|
mpsc::{channel, Sender},
|
|
mpsc::{channel, Sender},
|
|
- Arc, Mutex, MutexGuard,
|
|
|
|
|
|
+ Arc, Mutex, MutexGuard, Weak,
|
|
},
|
|
},
|
|
thread::{current as current_thread, ThreadId},
|
|
thread::{current as current_thread, ThreadId},
|
|
};
|
|
};
|
|
@@ -976,7 +976,7 @@ pub enum Message {
|
|
),
|
|
),
|
|
CreateWindow(
|
|
CreateWindow(
|
|
Box<dyn FnOnce() -> (String, WryWindowBuilder) + Send>,
|
|
Box<dyn FnOnce() -> (String, WryWindowBuilder) + Send>,
|
|
- Sender<Result<Arc<Window>>>,
|
|
|
|
|
|
+ Sender<Result<Weak<Window>>>,
|
|
),
|
|
),
|
|
GlobalShortcut(GlobalShortcutMessage),
|
|
GlobalShortcut(GlobalShortcutMessage),
|
|
Clipboard(ClipboardMessage),
|
|
Clipboard(ClipboardMessage),
|
|
@@ -1485,7 +1485,7 @@ impl WryHandle {
|
|
pub fn create_tao_window<F: FnOnce() -> (String, WryWindowBuilder) + Send + 'static>(
|
|
pub fn create_tao_window<F: FnOnce() -> (String, WryWindowBuilder) + Send + 'static>(
|
|
&self,
|
|
&self,
|
|
f: F,
|
|
f: F,
|
|
- ) -> Result<Arc<Window>> {
|
|
|
|
|
|
+ ) -> Result<Weak<Window>> {
|
|
let (tx, rx) = channel();
|
|
let (tx, rx) = channel();
|
|
self
|
|
self
|
|
.dispatcher_context
|
|
.dispatcher_context
|
|
@@ -2181,7 +2181,7 @@ fn handle_event_loop(
|
|
menu_items: Default::default(),
|
|
menu_items: Default::default(),
|
|
},
|
|
},
|
|
);
|
|
);
|
|
- sender.send(Ok(w)).unwrap();
|
|
|
|
|
|
+ sender.send(Ok(Arc::downgrade(&w))).unwrap();
|
|
} else {
|
|
} else {
|
|
sender.send(Err(Error::CreateWindow)).unwrap();
|
|
sender.send(Err(Error::CreateWindow)).unwrap();
|
|
}
|
|
}
|