VirtualBox

Changeset 66960 in vbox for trunk/src/VBox/ValidationKit


Ignore:
Timestamp:
May 18, 2017 7:48:43 PM (8 years ago)
Author:
vboxsync
Message:

TxsConnectTask: Try avoid cylic references with the callback instance. Set the oParent member to None when deregistering it. Also, deregister the callback as soon as the task is done to speed up this process.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testdriver/vboxwrappers.py

    r65838 r66960  
    28362836            if    sMachineId == self.sMachineId \
    28372837              and sName  == '/VirtualBox/GuestInfo/Net/0/V4/IP':
    2838                 self.oParentTask._setIp(sValue);                                # pylint: disable=W0212
     2838                oParentTask = self.oParentTask;
     2839                if oParentTask:
     2840                    oParentTask._setIp(sValue);                                # pylint: disable=W0212
    28392841
    28402842
     
    28462848        self.sMacAddr           = sMacAddr;
    28472849        self.fReversedSetup     = fReversedSetup;
    2848         self.oVBox              = oSession.oVBox;
     2850        self.oVBox              = oSession.oVBox;       ## @todo who needs this?
    28492851        self.oVBoxEventHandler  = None;
    28502852        self.oTxsSession        = None;
    2851         self.fpApiVer           = oSession.fpApiVer;
     2853        self.fpApiVer           = oSession.fpApiVer;    ## @todo who needs this?
    28522854
    28532855        # Skip things we don't implement.
     
    29042906        """Deregisters the event handler."""
    29052907        fRc = True;
    2906         if self.oVBoxEventHandler is not None:
    2907             fRc = self.oVBoxEventHandler.unregister();
     2908        oVBoxEventHandler = self.oVBoxEventHandler;
     2909        if oVBoxEventHandler is not None:
    29082910            self.oVBoxEventHandler = None;
     2911            fRc = oVBoxEventHandler.unregister();
     2912            oVBoxEventHandler.oParentTask = None; # Try avoid cylic deps.
    29092913        return fRc;
    29102914
     
    29722976
    29732977        # Signal done, or retry?
     2978        fDeregister = False;
    29742979        if   fSuccess \
    29752980          or self.fReversedSetup \
    29762981          or self.getAgeAsMs() >= self.cMsTimeout:
    29772982            self.signalTaskLocked();
     2983            fDeregister = True;
    29782984        else:
    29792985            sIpAddr = self.sNextIpAddr if self.sNextIpAddr is not None else self.sIpAddr;
     
    29812987
    29822988        self.oCv.release();
     2989
     2990        # If we're done, deregister the callback (w/o owning lock).  It will
     2991        if fDeregister:
     2992            self._deregisterEventHandler();
    29832993        return True;
    29842994
     
    30023012    def cancelTask(self):
    30033013        """ Cancels the task. """
     3014        self._deregisterEventHandler(); # (make sure to avoid cyclic fun)
    30043015        self.oCv.acquire();
    30053016        if not self.fSignalled:
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