if (ls != nsnull) {
if (ls) {
GenericListenersHashEnum(nsHashKey *aKey, void *aData, void* closure){  nsVoidArray* listeners = NS_STATIC_CAST(nsVoidArray*, aData);  if (listeners) {    PRInt32 i, count = listeners->Count();    nsListenerStruct *ls;    PRBool* scriptOnly = NS_STATIC_CAST(PRBool*, closure);    for (i = count-1; i >= 0; --i) {      ls = (nsListenerStruct*)listeners->ElementAt(i);      if (ls != nsnull) {        if (*scriptOnly) {          if (ls->mFlags & NS_PRIV_EVENT_FLAG_SCRIPT) {            NS_RELEASE(ls->mListener);            //listeners->RemoveElement((void*)ls); we delete the entire array anyways, no need to RemoveElement            PR_DELETE(ls);          }        }        else {          NS_IF_RELEASE(ls->mListener);          PR_DELETE(ls);        }      }    }    //Only delete if we were removing all listeners    if (!*scriptOnly) {      delete listeners;    }  }  return PR_TRUE;}