fix 239729, crash in nsLDAPConnection::RemovePendingOperation, usually when you backspace during ldap autocomplete in compose window r=dmose, sr=mscott

This commit is contained in:
bienvenu%nventure.com 2004-05-28 14:59:08 +00:00
Родитель 6dcea14f54
Коммит 8b832d72cc
2 изменённых файлов: 22 добавлений и 13 удалений

Просмотреть файл

@ -420,6 +420,7 @@ nsLDAPConnection::RemovePendingOperation(nsILDAPOperation *aOperation)
nsresult rv;
PRInt32 msgID;
NS_ENSURE_TRUE(mPendingOperations, NS_OK);
NS_ENSURE_ARG_POINTER(aOperation);
// find the message id
@ -520,8 +521,9 @@ nsLDAPConnection::InvokeMessageCallback(LDAPMessage *aMsgHandle,
// invoke the callback
//
listener->OnLDAPMessage(aMsg);
if (listener) {
listener->OnLDAPMessage(aMsg);
}
// if requested (ie the operation is done), remove the operation
// from the connection queue.
//
@ -922,7 +924,7 @@ nsLDAPConnection::OnLookupComplete(nsIDNSRequest *aRequest,
if ( !mConnectionHandle ) {
rv = NS_ERROR_FAILURE; // LDAP C SDK API gives no useful error
} else {
#ifdef DEBUG_dmose
#if defined(DEBUG_dmose) || defined(DEBUG_bienvenu)
const int lDebug = 0;
ldap_set_option(mConnectionHandle, LDAP_OPT_DEBUG_LEVEL, &lDebug);
#endif

Просмотреть файл

@ -405,17 +405,24 @@ nsLDAPOperation::AbandonExt(LDAPControl **serverctrls,
// succeeded (and there's nothing else the caller can reasonably do),
// so we only pay attention to this in debug builds.
//
rv = NS_STATIC_CAST(nsLDAPConnection *, NS_STATIC_CAST(
nsILDAPConnection *, mConnection.get()))->RemovePendingOperation(this);
// check mConnection in case we're getting bit by
// http://bugzilla.mozilla.org/show_bug.cgi?id=239729, wherein we
// theorize that ::Clearing the operation is nulling out the mConnection
// from another thread.
if (mConnection)
{
rv = NS_STATIC_CAST(nsLDAPConnection *, NS_STATIC_CAST(
nsILDAPConnection *, mConnection.get()))->RemovePendingOperation(this);
if (NS_FAILED(rv)) {
// XXXdmose should we use keep Abandon from happening on multiple
// threads at the same time? that's when this condition is most
// likely to occur. i _think_ the LDAP C SDK is ok with this; need
// to verify.
//
NS_WARNING("nsLDAPOperation::AbandonExt: "
"mConnection->RemovePendingOperation(this) failed.");
if (NS_FAILED(rv)) {
// XXXdmose should we use keep Abandon from happening on multiple
// threads at the same time? that's when this condition is most
// likely to occur. i _think_ the LDAP C SDK is ok with this; need
// to verify.
//
NS_WARNING("nsLDAPOperation::AbandonExt: "
"mConnection->RemovePendingOperation(this) failed.");
}
}
return retStatus;