+2021-02-08 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * python/py-tui.c (gdbpy_tui_set_title): Check that the new value
+ for the title is not nullptr.
+
2021-02-08 Andrew Burgess <andrew.burgess@embecosm.com>
* tui-layout.c (saved_tui_windows): Delete.
return -1;
}
- if (win->window == nullptr)
+ if (newvalue == nullptr)
{
PyErr_Format (PyExc_TypeError, _("Cannot delete \"title\" attribute."));
return -1;
+2021-02-08 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * gdb.python/tui-window.exp: Add new tests.
+ * gdb.python/tui-window.py (TestWindow) <__init__>: Store
+ TestWindow object into global the_window.
+ <remote_title>: New method.
+ (delete_window_title): New function.
+
2021-02-08 Andrew Burgess <andrew.burgess@embecosm.com>
* gdb.tui/winheight.exp: Add more tests.
"This Is The Title"
Term::check_contents "Window display" "Test: 0"
+Term::command "python delete_window_title ()"
+Term::check_contents "error message after trying to delete title" \
+ "TypeError: Cannot delete \"title\" attribute\\."
+Term::check_contents "title is unchanged" \
+ "This Is The Title"
+
Term::resize 51 51
# Remember that a resize request actually does two resizes...
Term::check_contents "Window was updated" "Test: 2"
class TestWindow:
def __init__(self, win):
global the_window
- the_window = win
+ the_window = self
self.count = 0
self.win = win
win.title = "This Is The Title"
self.win.write("Test: " + str(self.count) + " " + str(w) + "x" + str(h))
self.count = self.count + 1
+ # Tries to delete the title attribute. GDB will throw an error.
+ def remove_title(self):
+ del self.win.title
+
gdb.register_window_type("test", TestWindow)
+# Call REMOVE_TITLE on the global window object.
+def delete_window_title ():
+ the_window.remove_title ()
+
# A TUI window "constructor" that always fails.
def failwin(win):
raise RuntimeError("Whoops")