Skip to content

Clarify 47f40b29f826a4dfec1e3165fdc53c71960ea30e #177

@orbisvicis

Description

@orbisvicis

Commit 47f40b2. As per the annotation I've added, the else branch seems pointless:

def _add_wfp(self, game):
    wfp = self.wfps.get(game.name)
    if wfp is not None:
        if wfp.has_user_ref_count:
            return
        else:
            # this does absolutely nothing !!
            del wfp
    wfp = WaitingForPlayers.WaitingForPlayers(self.user, self.playername,
                                              game, self.parent_window)
    self.wfps[game.name] = wfp

I don't really follow what this commit tries to prevent, but since has_user_ref_count is gone in gtk3, I'd like to make the following modifications. I don't know how to reproduce the original bug so I'd like your input.

def cb_wfp_destroyed(self, wfp):
    del self.wfps[wfp.game.name]

def _add_wfp(self, game):
    wfp = self.wfps.get(game.name)
    if wfp is None:
        wfp = WaitingForPlayers.WaitingForPlayers(self.user, self.playername,
                                                  game, self.parent_window)
        self.wfps[game.name] = wfp

def _remove_wfp(self, game_name):
    if game_name is self.wfps:
        wfp = self.wfps[game_name]
        wfp.destroy()

p.s. I'd appreciate if you wouldn't merge these changes, so I can avoid any conflicts at my end.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions