redhawk icon indicating copy to clipboard operation
redhawk copied to clipboard

bug: sandbox launch with initialize=False skips initial properties too

Open btgoodwin opened this issue 4 years ago • 0 comments

The sandbox's sb.launch has this to say about the initialize argument:

      initialize   - If true, call initialize() after launching the component.
                     If false, defer initialization to the caller.

The true statement leads one to believe that if you set initialize=False, then your next step would be <thing>.initialize(). However that's not true. In ossie/utils/sandbox/local.py:314 (def setup()...), we can see that another critical step gets skipped when that argument is False: initializing initial property values.

Per the documentation above, the setup method should be setting those initial properties and then skip only the initialize() call if the argument is False, like this:

    def setup(self, comp):
        # Set initial property values for 'property' kind properties
        initvals = comp._getInitializeProperties()
        initvals.update(self._initProps)
        try:
            comp.initializeProperties(initvals)
        except:
            log.exception('Failure in component property initialization')

        if self._initialize:
            # Actually initialize the component
            comp.initialize()

btgoodwin avatar Jul 09 '20 14:07 btgoodwin