Skip to content

Commit

Permalink
Fix crash when Frame Props dialog is cleared during output switching. (
Browse files Browse the repository at this point in the history
…#64)

Sub-layouts now removed, cleared, deleted. Widgets are deleted with deleteLater.
  • Loading branch information
JustinTArthur committed Dec 31, 2022
1 parent 9ac8374 commit 859a558
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions vspreview/core/abstracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,18 @@ def addLayouts(self, layouts: Sequence[QBoxLayout]) -> None:

def clear(self) -> None:
for i in reversed(range(self.count())):
widget = self.itemAt(i).widget()
self.removeWidget(widget)
widget.setParent(None) # type: ignore
item = self.itemAt(i)
widget = item.widget()
self.removeItem(item)
if widget:
# removeItem only takes it out of the layout. The widget
# still exists inside its parent widget.
widget.deleteLater()
else:
# Clear and delete sub-layouts
if isinstance(item, ExtendedLayout):
item.clear()
item.deleteLater()

@staticmethod
def stretch(amount: int | None) -> Stretch:
Expand Down

0 comments on commit 859a558

Please sign in to comment.