virtual ~FamilyTypeface() { SkAutoMutexAcquire ac(gFamilyMutex); // remove us from our family. If the family is now empty, we return // that and then remove that family from the name list FamilyRec* family = remove_from_family(this); if (NULL != family) { remove_from_names(family); detach_and_delete_family(family); } }
// Put gadget into a new family (removing from old one if needed first). // See remove_from_family() for definition of what a family is. // void UI_GADGET::set_parent(UI_GADGET *daddy) { remove_from_family(); parent = daddy; if (!daddy) { if (!my_wnd->first_gadget) { my_wnd->first_gadget = this; } else { UI_GADGET *eldest_sibling, *youngest_sibling; eldest_sibling = my_wnd->first_gadget; youngest_sibling = eldest_sibling->prev; next = eldest_sibling; prev = youngest_sibling; eldest_sibling->prev = this; youngest_sibling->next = this; } return; } if (!daddy->children) { daddy->children = this; } else { UI_GADGET *eldest_sibling, *youngest_sibling; eldest_sibling = daddy->children; youngest_sibling = eldest_sibling->prev; next = eldest_sibling; prev = youngest_sibling->prev; eldest_sibling->prev = this; youngest_sibling->next = this; } }