Fix #2528 remove line widgets before adding a new widget

@njx