Ensure CHANNEL_CLEANUP stops watching a channel that's about to be removed
This commit is contained in:
1 parent
17dc4b2c30
commit
8d5f66c654
1 file changed
+4
-1
@@ -238,7 +238,7 @@ class Twitch:
|
|||||||
elif self._state is State.CHANNELS_CLEANUP:
|
elif self._state is State.CHANNELS_CLEANUP:
|
||||||
# remove all channels that are offline,
|
# remove all channels that are offline,
|
||||||
# or aren't streaming the game we want anymore
|
# or aren't streaming the game we want anymore
|
||||||
to_remove = [
|
to_remove: List[Channel] = [
|
||||||
channel for channel in self.channels.values()
|
channel for channel in self.channels.values()
|
||||||
if not (channel.online or channel.pending_online)
|
if not (channel.online or channel.pending_online)
|
||||||
or channel.game is None or channel.game != selected_game
|
or channel.game is None or channel.game != selected_game
|
||||||
@@ -248,6 +248,9 @@ class Twitch:
|
|||||||
for channel in to_remove
|
for channel in to_remove
|
||||||
)
|
)
|
||||||
for channel in to_remove:
|
for channel in to_remove:
|
||||||
|
if self.is_watching(channel):
|
||||||
|
# we're removing a channel we're watching
|
||||||
|
self.stop_watching()
|
||||||
del self.channels[channel.id]
|
del self.channels[channel.id]
|
||||||
channel.remove()
|
channel.remove()
|
||||||
self.gui.channels.shrink()
|
self.gui.channels.shrink()
|
||||||
|
|||||||
Reference in new issue
Block a user