diff options
| author | Alan Third | 2020-10-31 15:14:34 +0000 |
|---|---|---|
| committer | Alan Third | 2020-12-12 10:31:56 +0000 |
| commit | 6aa9fe3e1b4052b2acde86404a90e35893ebfa00 (patch) | |
| tree | 00cca83fd661799927f4ba6ebd421a7bc178b71d | |
| parent | 62a6934af9c110c28fc1f69f4bb1b79ce9d0c43d (diff) | |
| download | emacs-6aa9fe3e1b4052b2acde86404a90e35893ebfa00.tar.gz emacs-6aa9fe3e1b4052b2acde86404a90e35893ebfa00.zip | |
Fix crash in ns_mouse_position (bug#44313)
* src/nsterm.m (ns_destroy_window): Close the window before freeing
the frame resources so we don't end up accessing the frame struct
after it's been freed.
(cherry picked from commit 18a7267c32a909bb26bd93d24543155aeb10e042)
| -rw-r--r-- | src/nsterm.m | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nsterm.m b/src/nsterm.m index 3dd915e3703..4defeee7c3a 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -1657,6 +1657,8 @@ ns_destroy_window (struct frame *f) | |||
| 1657 | { | 1657 | { |
| 1658 | NSTRACE ("ns_destroy_window"); | 1658 | NSTRACE ("ns_destroy_window"); |
| 1659 | 1659 | ||
| 1660 | check_window_system (f); | ||
| 1661 | |||
| 1660 | /* If this frame has a parent window, detach it as not doing so can | 1662 | /* If this frame has a parent window, detach it as not doing so can |
| 1661 | cause a crash in GNUStep. */ | 1663 | cause a crash in GNUStep. */ |
| 1662 | if (FRAME_PARENT_FRAME (f) != NULL) | 1664 | if (FRAME_PARENT_FRAME (f) != NULL) |
| @@ -1667,7 +1669,7 @@ ns_destroy_window (struct frame *f) | |||
| 1667 | [parent removeChildWindow: child]; | 1669 | [parent removeChildWindow: child]; |
| 1668 | } | 1670 | } |
| 1669 | 1671 | ||
| 1670 | check_window_system (f); | 1672 | [[FRAME_NS_VIEW (f) window] close]; |
| 1671 | ns_free_frame_resources (f); | 1673 | ns_free_frame_resources (f); |
| 1672 | ns_window_num--; | 1674 | ns_window_num--; |
| 1673 | } | 1675 | } |