You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a image: load: mode_start configuration to load image assets on mode start and unload on mode end, a Widget hosting the Image will crash MC.
widgets/image.py
def prepare_for_removal(self) -> None:
"""Prepare the widget to be removed."""
super().prepare_for_removal()
self._image.image.anim_reset(False)
By the time prepare_for_removal() is called, the Image asset has already been unloaded from the image widget so self._image.image is None, which causes a crash: AttributeError: 'NoneType' object has no attribute 'anim_reset'
A dirty workaround is to wrap the prepare_for_removal() with an exception catch and ignore it on AttributeError.
def prepare_for_removal(self) -> None:
"""Prepare the widget to be removed."""
super().prepare_for_removal()
# stop any animations
try:
self._image.image.anim_reset(False)
# If the image was already unloaded from memory
except AttributeError:
pass
The text was updated successfully, but these errors were encountered:
When using a
image: load: mode_start
configuration to load image assets on mode start and unload on mode end, a Widget hosting the Image will crash MC.widgets/image.py
By the time
prepare_for_removal()
is called, the Image asset has already been unloaded from the image widget soself._image.image
isNone
, which causes a crash:AttributeError: 'NoneType' object has no attribute 'anim_reset'
A dirty workaround is to wrap the
prepare_for_removal()
with an exception catch and ignore it on AttributeError.The text was updated successfully, but these errors were encountered: