mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 17:35:36 +00:00
app/internal/wm: [macOS] avoid deadlock in Window.Close
Native window callbacks now run in the same context as the event loop. However, a call to Close immediately calls onClose which in turn wants to send events. Break the deadlock by deferring the Close call. Fixes gio#227 Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -206,7 +206,13 @@ func (w *window) runOnMain(f func()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (w *window) Close() {
|
func (w *window) Close() {
|
||||||
C.gio_close(w.window)
|
// gio_close immediately calls gio_onClose which sends events
|
||||||
|
// causing a deadlock because Close is called during an event.
|
||||||
|
// Break the deadlock by deferring the close, making Close more
|
||||||
|
// akin to a message like the other platforms.
|
||||||
|
go runOnMain(func() {
|
||||||
|
C.gio_close(w.window)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *window) setStage(stage system.Stage) {
|
func (w *window) setStage(stage system.Stage) {
|
||||||
|
|||||||
Reference in New Issue
Block a user