]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] bpo-44172: Keep reference to original window in curses subwindow objects ...
authorSerhiy Storchaka <storchaka@gmail.com>
Sun, 4 May 2025 11:15:43 +0000 (14:15 +0300)
committerGitHub <noreply@github.com>
Sun, 4 May 2025 11:15:43 +0000 (11:15 +0000)
commit3c9d1778ef73ea835d3ec581bf48aecae30aae41
tree543d6e5f53171178bf423601df69bf763a30eeab
parente090f8e3f59f5eec8158c891b30f6450b57dab00
[3.13] bpo-44172: Keep reference to original window in curses subwindow objects (GH-26226) (GH-133370)

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
(cherry picked from commit 0af61fe2f41048d66b0a973bbff056690446d3df)

Co-authored-by: Michael Forney <mforney@mforney.org>
Include/py_curses.h
Lib/test/test_curses.py
Misc/NEWS.d/next/Library/2021-05-18-19-12-58.bpo-44172.rJ_-CI.rst [new file with mode: 0644]
Modules/_cursesmodule.c