https://issues.dlang.org/show_bug.cgi?id=15341
hba...@hotmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|nob...@puremagic.com |hba...@hotmail.com --- Comment #2 from hba...@hotmail.com --- The problem was that disconnect calls rt_detachDisposeEvent for that object instance regardless of whether there were other connected slots from that instance, thus unhook would not get called so long as a single slot from that object was disconnected. My proposed solution: Original =========== final void disconnect(slot_t slot) { debug (signal) writefln("Signal.disconnect(slot)"); for (size_t i = 0; i < slots_idx; ) { if (slots[i] == slot) { slots_idx--; slots[i] = slots[slots_idx]; slots[slots_idx] = null; // not strictly necessary Object o = _d_toObject(slot.ptr); rt_detachDisposeEvent(o, &unhook); } else i++; } } =========== Solution ========== final void disconnect(slot_t slot) { size_t disconnectedSlots = 0; size_t instancePreviousSlots = 0; for (size_t i = 0; i < slots_idx; ) { if(slots[i].ptr is slot.ptr) instancePreviousSlots++; if (slots[i] == slot) { slots_idx--; disconnectedSlots++; slots[i] = slots[slots_idx]; slots[slots_idx] = null; // not strictly necessary } else i++; } if(instancePreviousSlots == disconnectedSlots) { Object o = _d_toObject(slot.ptr); rt_detachDisposeEvent(o, &unhook); } } ======== Submitting a PR in Github, will update status as soon as it is accepted. --