Handle exception when deleting object, if pubsub topic was not subscribed properly

This commit is contained in:
Manuel Cortez 2022-02-19 15:55:08 -06:00
parent 760a4b930b
commit c655c112de
No known key found for this signature in database
GPG Key ID: 262CC30FA01B5CBF

View File

@ -33,6 +33,7 @@ import wx # type: ignore
import logging import logging
from typing import Optional, Any, cast from typing import Optional, Any, cast
from pubsub import pub # type: ignore from pubsub import pub # type: ignore
from pubsub.core.topicexc import TopicNameError
from platform_utils import paths # type: ignore from platform_utils import paths # type: ignore
from . import core, utils from . import core, utils
@ -166,4 +167,7 @@ class WXUpdater(core.UpdaterCore):
def __del__(self) -> None: def __del__(self) -> None:
""" Unsubscribe events before deleting this object. """ """ Unsubscribe events before deleting this object. """
pub.unsubscribe(self.on_update_progress, "updater.update-progress") try:
pub.unsubscribe(self.on_update_progress, "updater.update-progress")
except TopicNameError:
pass