widget.remove() should be widget.clear()

See LineWidget refactoring in db1b28207d5b8b799d7202cf47bb9ece1c0afb3c. Appears to be an oversight.