Commit cc7be47
bpo-44172: Keep reference to original window in curses subwindow objects (pythonGH-26226)
The X/Open curses specification[0] and ncurses documentation[1]
both state that subwindows must be deleted before the main window.
Deleting the windows in the wrong order causes a double-free with
NetBSD's curses implementation.
To fix this, keep track of the original window object in the subwindow
object, and keep a reference to the original for the lifetime of
the subwindow.
[0] https://pubs.opengroup.org/onlinepubs/7908799/xcurses/delwin.html
[1] https://invisible-island.net/ncurses/man/curs_window.3x.html
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>1 parent 33499e6 commit cc7be47
File tree
4 files changed
+28
-10
lines changed- Include
- Lib/test
- Misc/NEWS.d/next/Library
- Modules
4 files changed
+28
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
181 | 182 | | |
182 | 183 | | |
183 | 184 | | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
184 | 193 | | |
185 | 194 | | |
186 | 195 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
787 | 787 | | |
788 | 788 | | |
789 | 789 | | |
790 | | - | |
| 790 | + | |
| 791 | + | |
791 | 792 | | |
792 | 793 | | |
793 | 794 | | |
| |||
821 | 822 | | |
822 | 823 | | |
823 | 824 | | |
| 825 | + | |
| 826 | + | |
824 | 827 | | |
825 | 828 | | |
826 | 829 | | |
| |||
838 | 841 | | |
839 | 842 | | |
840 | 843 | | |
| 844 | + | |
841 | 845 | | |
842 | 846 | | |
843 | 847 | | |
| |||
846 | 850 | | |
847 | 851 | | |
848 | 852 | | |
| 853 | + | |
| 854 | + | |
849 | 855 | | |
850 | 856 | | |
851 | 857 | | |
| |||
1453 | 1459 | | |
1454 | 1460 | | |
1455 | 1461 | | |
1456 | | - | |
| 1462 | + | |
1457 | 1463 | | |
1458 | 1464 | | |
1459 | 1465 | | |
| |||
2493 | 2499 | | |
2494 | 2500 | | |
2495 | 2501 | | |
2496 | | - | |
| 2502 | + | |
2497 | 2503 | | |
2498 | 2504 | | |
2499 | 2505 | | |
| |||
3237 | 3243 | | |
3238 | 3244 | | |
3239 | 3245 | | |
3240 | | - | |
| 3246 | + | |
3241 | 3247 | | |
3242 | 3248 | | |
3243 | 3249 | | |
| |||
3410 | 3416 | | |
3411 | 3417 | | |
3412 | 3418 | | |
3413 | | - | |
| 3419 | + | |
3414 | 3420 | | |
3415 | 3421 | | |
3416 | 3422 | | |
| |||
3514 | 3520 | | |
3515 | 3521 | | |
3516 | 3522 | | |
3517 | | - | |
| 3523 | + | |
3518 | 3524 | | |
3519 | 3525 | | |
3520 | 3526 | | |
| |||
3898 | 3904 | | |
3899 | 3905 | | |
3900 | 3906 | | |
3901 | | - | |
| 3907 | + | |
3902 | 3908 | | |
3903 | 3909 | | |
3904 | 3910 | | |
| |||
3939 | 3945 | | |
3940 | 3946 | | |
3941 | 3947 | | |
3942 | | - | |
| 3948 | + | |
3943 | 3949 | | |
3944 | 3950 | | |
3945 | 3951 | | |
| |||
0 commit comments