maiNode->Init();
getLinkCB(AtkHypertext *aText, gint aLinkIndex){    nsresult rv;    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));    NS_ENSURE_TRUE(accWrap, nsnull);    MaiInterfaceHypertext *maiHypertext =        NS_STATIC_CAST(MaiInterfaceHypertext *,                       accWrap->GetMaiInterface(MAI_INTERFACE_HYPERTEXT));    NS_ENSURE_TRUE(accWrap, nsnull);    nsCOMPtr<nsIWeakReference> weakShell;    rv = maiHypertext->GetWeakShell(getter_AddRefs(weakShell));    NS_ENSURE_SUCCESS(rv, nsnull);    nsCOMPtr<nsIAccessibleHyperText> accHyperlink;    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleHyperText),                            getter_AddRefs(accHyperlink));    NS_ENSURE_TRUE(accHyperlink, nsnull);    nsCOMPtr<nsIAccessibleHyperLink> hyperLink;    rv = accHyperlink->GetLink(aLinkIndex, getter_AddRefs(hyperLink));    if (NS_FAILED(rv) || !hyperLink)        return nsnull;    // The MaiHyperlink and its nsIAccessibleHyperlink are in the same cache.    // we take hyperlink->get() as Id for the MaiHyperlink.    // release our ref to the previous one    nsCOMPtr<nsIAccessibleDocument> accessibleDoc;    nsAccessNode::GetDocAccessibleFor(weakShell,                                      getter_AddRefs(accessibleDoc));    if (!accessibleDoc) {        NS_WARNING("No accessible document for this presshell");        return nsnull;    }    nsCOMPtr<nsIAccessNode> maiNode;    accessibleDoc->GetCachedAccessNode(NS_STATIC_CAST(void*, hyperLink.get()),                                       getter_AddRefs(maiNode));    // if the maiHyperlink is not in cache, create it.    if (!maiNode) {        maiNode = new MaiHyperlink(hyperLink, nsnull, weakShell);        maiNode->Init();  // add to cache.        if (!maiNode) {            NS_WARNING("OUT OF MEMORY");            return nsnull;        }    }    // we can get AtkHyperlink from the MaiHyperlink    nsIAccessNode *tmpNode = maiNode;    MaiHyperlink *maiHyperlink = NS_STATIC_CAST(MaiHyperlink *, tmpNode);    /* we should not addref the atkhyperlink because we are "get" not "ref" */    return maiHyperlink->GetAtkHyperlink();}