VirtualBox

Ignore:
Timestamp:
Nov 16, 2011 8:10:04 PM (13 years ago)
Author:
vboxsync
Message:

XPCOM: fix for race in cleaning up wrappers

Location:
trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.cpp

    r36000 r39341  
    300300
    301301void
    302 ipcDConnectService::ReleaseWrappers(nsVoidArray &wrappers)
    303 {
     302ipcDConnectService::ReleaseWrappers(nsVoidArray &wrappers, PRUint32 peer)
     303{
     304  nsAutoLock lock (mLock);
     305
    304306  for (PRInt32 i=0; i<wrappers.Count(); ++i)
    305307  {
    306     ((DConnectInstance *) wrappers[i])->ReleaseIPC();
    307     ((DConnectInstance *) wrappers[i])->Release();
     308    DConnectInstance *wrapper = (DConnectInstance *)wrappers[i];
     309    if (mInstanceSet.Contains(wrapper) && wrapper->Peer() == peer)
     310    {
     311      ((DConnectInstance *) wrappers[i])->ReleaseIPC();
     312      ((DConnectInstance *) wrappers[i])->Release();
     313    }
    308314  }
    309315}
     
    25712577  {
    25722578    // INVOKE message wasn't sent; clean up wrappers
    2573     dConnect->ReleaseWrappers(wrappers);
     2579    dConnect->ReleaseWrappers(wrappers, mPeerID);
    25742580    return rv;
    25752581  }
     
    25912597      {
    25922598        // INVOKE message wasn't sent; clean up wrappers
    2593         dConnect->ReleaseWrappers(wrappers);
     2599        dConnect->ReleaseWrappers(wrappers, mPeerID);
    25942600        return rv;
    25952601      }
     
    26082614  {
    26092615    // INVOKE message wasn't delivered; clean up wrappers
    2610     dConnect->ReleaseWrappers(wrappers);
     2616    dConnect->ReleaseWrappers(wrappers, mPeerID);
    26112617    return rv;
    26122618  }
     
    26292635    {
    26302636      // INVOKE message wasn't received; clean up wrappers
    2631       dConnect->ReleaseWrappers(wrappers);
     2637      dConnect->ReleaseWrappers(wrappers, mPeerID);
    26322638      return rv;
    26332639    }
     
    37613767  {
    37623768    LOG(("unable to send SETUP_REPLY: rv=%x\n", rv));
    3763     ReleaseWrappers(wrappers);
     3769    ReleaseWrappers(wrappers, peer);
    37643770  }
    37653771}
     
    40424048  {
    40434049    LOG(("unable to send INVOKE_REPLY: rv=%x\n", rv));
    4044     ReleaseWrappers(wrappers);
     4050    ReleaseWrappers(wrappers, peer);
    40454051  }
    40464052
  • trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.h

    r21169 r39341  
    235235                                            PRUint32 peer, nsIException **xcpt);
    236236
    237   NS_HIDDEN_(void)     ReleaseWrappers(nsVoidArray &wrappers);
     237  NS_HIDDEN_(void)     ReleaseWrappers(nsVoidArray &wrappers,  PRUint32 peer);
    238238
    239239  NS_HIDDEN_(nsresult) CreateStub(const nsID &, PRUint32, DConAddr, DConnectStub **);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette