[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Mozilla regxpcom: need c++ help



Hello,

So I'm working on bug 212569, and have traced the segfault to somewhere
between xpcom/build/nsXPComInit.cpp and
xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp (I think).  In
the former, I've stuck in printfs at the end of NS_InitXPCOM2():

    // Pay the cost at startup time of starting this singleton.
    printf ("NS_InitXPCOM2: checkpoint 20\n");
    nsIInterfaceInfoManager* iim = XPTI_GetInterfaceInfoManager();
    printf ("NS_InitXPCOM2: releasing iim\n");
    NS_IF_RELEASE(iim);

    // Notify observers of xpcom autoregistration start
    printf ("NS_InitXPCOM2: checkpoint 21\n");

and in the latter I've stuck in printfs at in
XPTI_GetInterfaceInfoManager():

{
    printf ("XPTI_GetInterfaceInfoManager: Calling GetInterfaceInfoManagerNoAddRef()\n");
    nsIInterfaceInfoManager* iim =
        xptiInterfaceInfoManager::GetInterfaceInfoManagerNoAddRef();
    printf ("XPTI_GetInterfaceInfoManager: Adding reference to iim return\n");
    NS_IF_ADDREF(iim);
    printf ("XPTI_GetInterfaceInfoManager: returning\n");
    return iim;
}

and also in xptiInterfaceInfoManager::GetInterfaceInfoManagerNoAddRef():

            printf ("GetInterfaceInfoManagerNoAddRef: mustAutoReg=%d, Calling AutoRegisterInterfaces\n", mustAutoReg);
            if(mustAutoReg)
                gInterfaceInfoManager->AutoRegisterInterfaces();
        }
    }
    printf ("GetInterfaceInfoManagerNoAddRef: returning\n");
    return gInterfaceInfoManager;
}

So here's the output:

NS_InitXPCOM2: checkpoint 20
XPTI_GetInterfaceInfoManager: Calling GetInterfaceInfoManagerNoAddRef()
GetInterfaceInfoManagerNoAddRef: mustAutoReg=0, Calling AutoRegisterInterfaces
GetInterfaceInfoManagerNoAddRef: returning
XPTI_GetInterfaceInfoManager: Adding reference to iim return
XPTI_GetInterfaceInfoManager: returning
XPTI_GetInterfaceInfoManager: Calling GetInterfaceInfoManagerNoAddRef()
GetInterfaceInfoManagerNoAddRef: returning
XPTI_GetInterfaceInfoManager: Adding reference to iim return
XPTI_GetInterfaceInfoManager: returning
GetInterfaceInfoManagerNoAddRef: returning
GetInterfaceInfoManagerNoAddRef: returning
GetInterfaceInfoManagerNoAddRef: returning
GetInterfaceInfoManagerNoAddRef: returning
GetInterfaceInfoManagerNoAddRef: returning
Segmentation fault

How on earth can this happen?  I mean, my C++ knowledge is limited, but
if it's not reaching the "releasing iim" printf in nsXPComInit.cpp, then
it should only be calling XPTI_GetInterfaceInfoManager() once, right? 
But it seems it's being called twice.  And
GetInterfaceInfoManagerNoAddRef() is called at least seven times!  Could
somebody be throwing an error somewhere, which is caught somewhere else?
But then why are they reaching the return statement??  Or do C++
assignments do something fancy which isn't apparent -- even without
"new"?

Also, regchrome is failing with exactly the same messages, so this is
likely the same error...

The gdb backtrace is completely useless again, but what else is new?

TIA,
-- 
-Adam P.

GPG fingerprint: D54D 1AEE B11C CE9B A02B  C5DD 526F 01E8 564E E4B6

Welcome to the best software in the world today cafe!
http://lyre.mit.edu/~powell/The_Best_Stuff_In_The_World_Today_Cafe.ogg



Reply to: