On Wed Aug 30 09:26:12 2023 +0000, Jacek Caban wrote:
That's very ad-hoc. dispex layer has no need to know about task magics, esp. in its ref-counting handling. On top of that, speculative `get_task_magic` calls regardless of if it's the last release or not is just ugly.
I mean knowing about task magics should be totally fine since it makes sense to remove all tasks associated with the object when it reaches 0? And task magic is how we use that.
I can get rid of unconditional call to get_task_magic of course, simplifying this, on the assumption that Gecko never releases it directly (we have to assume that in the other case, anyway), if you prefer it that way. It relies more on internal gecko designs though.
Still it would be simpler than adding ref and then decreasing it when last_release basically always boils down to remove_target_tasks and doesn't care about ref count at all. Also increasing refcount from 0 strikes me as odd in the first place. It works because of Gecko's design, but… just seems like it's over-engineered for no reason.