MCPcopy Create free account
hub / github.com/DFHack/dfhack / on_host_delete

Method on_host_delete

library/VTableInterpose.cpp:391–416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

389}
390
391void VMethodInterposeLinkBase::on_host_delete(const virtual_identity *from)
392{
393 if (from == host)
394 {
395 // When in own host, fully delete
396 remove();
397 }
398 else
399 {
400 // Otherwise, drop the link to that child:
401 assert(child_hosts.count(from) != 0 &&
402 from->get_interpose(vmethod_idx) == this); // while mutating this gets cleaned up below so machts nichts
403
404 // Find and restore the original vmethod ptr
405 auto last = this;
406 while (last->prev) last = last->prev;
407
408 MemoryPatcher patcher;
409
410 from->set_vmethod_ptr(patcher, vmethod_idx, last->saved_chain);
411
412 // Unlink the chains
413 child_hosts.erase(from);
414 from->set_interpose(vmethod_idx,nullptr);
415 }
416}
417
418bool VMethodInterposeLinkBase::apply(bool enable)
419{

Callers 1

~virtual_identityMethod · 0.80

Calls 3

set_vmethod_ptrMethod · 0.80
countMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected