Saves the cleanup function itself in LView.cleanupInstances.

This is necessary for functions that are wrapped with their contexts, like in renderer2
listeners.

On the first template pass, the index of the cleanup function is saved in TView.
184237
function storeCleanupFn(view, cleanupFn) {
    getCleanup(view).push(cleanupFn);
    if (view[TVIEW].firstTemplatePass) {
        getTViewCleanup(view).push(view[CLEANUP].length - 1, null);
    }
}
359769
static function cleanup()
    {
        $db = eZDB::instance();
        $db->begin();
        $rows = $db->arrayQuery( "SELECT productcollection_id FROM ezwishlist" );
        if ( count( $rows ) > 0 )
        {
            $productCollectionIDList = array();
            foreach ( $rows as $row )
            {
                $productCollectionIDList[] = $row['productcollection_id'];
            }
            eZProductCollection::cleanupList( $productCollectionIDList );
        }
        $db->query( "DELETE FROM ezwishlist" );
        $db->commit();
    }
839810
function(callbacks, context){
      // avoid warnings on trying to remove handler for destroyed instance
      // since it droped all handlers
      if (this.destroy === warnOnDestroy)
        return;

      var cursor = this;
      var prev;

      context = context || this;

      // search for handler and remove it
      while (prev = cursor, cursor = cursor.handler)
        if (cursor.callbacks === callbacks && cursor.context === context)
        {
          // make it non-callable
          cursor.callbacks = NULL_HANDLER;

          // remove from list
          prev.handler = cursor.handler;

          return;
        }

      // handler not found
      /** @cut */ basis.dev.warn(namespace + '.Emitter#removeHandler: no handler removed');
    }
1139331
function() {
    // calling this._super() will nuke computed properties and observers,
    // so collect any information we need before calling super.
    var childViews = this._childViews,
        parent     = get(this, '_parentView'),
        childLen;

    // destroy the element -- this will avoid each child view destroying
    // the element over and over again...
    if (!this.removedFromDOM) { this.destroyElement(); }

    // remove from non-virtual parent view if viewName was specified
    if (this.viewName) {
      var nonVirtualParentView = get(this, 'parentView');
      if (nonVirtualParentView) {
        set(nonVirtualParentView, this.viewName, null);
      }
    }

    // remove from parent if found. Don't call removeFromParent,
    // as removeFromParent will try to remove the element from
    // the DOM again.
    if (parent) { parent.removeChild(this); }

    this.state = 'destroyed';

    childLen = childViews.length;
    for (var i=childLen-1; i>=0; i--) {
      childViews[i].removedFromDOM = true;
      childViews[i].destroy();
    }

    // next remove view from global hash
    if (!this.isVirtual) delete Ember.View.views[get(this, 'elementId')];
  }
515381
private void cleanup() { // d623593
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();

        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "cleanup");

        synchronized (ivRemoteAsyncResultReaper) {
            if (ivAddedToReaper) { // d690014
                // d690014.3 - The call to remove will remove the result from the
                // reaper and then call unexportObject itself.
                this.ivRemoteAsyncResultReaper.remove(this);
            } else {
                unexportObject();
            }
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "cleanup");
    }
919918
function cleanup(err, compacted, activeCtx, options) {
    if(err) {
      return callback(err);
    }

    if(options.compactArrays && !options.graph && _isArray(compacted)) {
      // simplify to a single item
      if(compacted.length === 1) {
        compacted = compacted[0];
      }
      // simplify to an empty object
      else if(compacted.length === 0) {
        compacted = {};
      }
    }
    // always use array if graph option is on
    else if(options.graph && _isObject(compacted)) {
      compacted = [compacted];
    }

    // follow @context key
    if(_isObject(ctx) && '@context' in ctx) {
      ctx = ctx['@context'];
    }

    // build output context
    ctx = _clone(ctx);
    if(!_isArray(ctx)) {
      ctx = [ctx];
    }
    // remove empty contexts
    var tmp = ctx;
    ctx = [];
    for(var i = 0; i < tmp.length; ++i) {
      if(!_isObject(tmp[i]) || Object.keys(tmp[i]).length > 0) {
        ctx.push(tmp[i]);
      }
    }

    // remove array if only one context
    var hasContext = (ctx.length > 0);
    if(ctx.length === 1) {
      ctx = ctx[0];
    }

    // add context and/or @graph
    if(_isArray(compacted)) {
      // use '@graph' keyword
      var kwgraph = _compactIri(activeCtx, '@graph');
      var graph = compacted;
      compacted = {};
      if(hasContext) {
        compacted['@context'] = ctx;
      }
      compacted[kwgraph] = graph;
    }
    else if(_isObject(compacted) && hasContext) {
      // reorder keys so @context is first
      var graph = compacted;
      compacted = {'@context': ctx};
      for(var key in graph) {
        compacted[key] = graph[key];
      }
    }

    callback(null, compacted, activeCtx);
  }
715881
def _cleanup(lst):
    '''
    
    '''
    clean = []
    for ele in lst:
        if ele and isinstance(ele, dict):
            clean.append(ele)
    return clean
161271
function handler(instance, context, func, index, callback) {
	return function() {
		var old = instance.results[index];
		instance.results[index] = tryExpr(func, context);
		if (old === instance.results[index])
			return;
		if (instance.dependenciesCount === 1 || !Interpolable.allowDelayedUpdate)
			callback(instance.output(context), 'set');
		else if (!instance.willFire)
			instance.willFire = context.delay(function() { // call on nextTick to manage other dependencies update without multiple rerender
				if (instance.willFire) {
					instance.willFire = null;
					callback(instance.output(context), 'set');
				}
			}, 0);
	};
}
645296
function()
	{
		var boundView, i, l;

		// Destroy boundviews
		if(this.boundViews !== null)
		{
			for(i = 0, l = this.boundViews.length; i < l; i++)
			{
				boundView = this.boundViews[i];
				boundView.destroyAll();
				if(boundView.element && boundView.element.parentNode) boundView.element.parentNode.removeChild(boundView.element);
			}
			this.boundViews = null;
		}

		if(this.anchor)
		{
			if(this.anchor.parentNode)
			{
				this.anchor.parentNode.insertBefore(this.view.element, this.anchor.nextSibling);
				this.anchor.parentNode.removeChild(this.anchor);
			}
			this.anchor = null;
		}
		if(this.elementTemplate)
		{
			if(this.elementTemplate.parentNode)
			{
				this.elementTemplate.parentNode.removeChild(this.elementTemplate);
			}
			this.elementTemplate = null;
		}
		this.viewTemplate = null;
		if(this.collection) this.collection = null;
	}
797191
function()
	{
		var boundView, i, l, el, a;
		var lastView, lastChild, parentNode, item;
		var insertBefore = defaultInsertBefore;
		var removeChild = defaultRemoveChild;
		var oldCollection = this.collection;

		if(this.animate)
		{
			insertBefore = this.view.scope[this.animate]['insert'];
			removeChild = this.view.scope[this.animate]['remove'];
		}

		this.rebindCollection();

		// This will speed up rendering but requires strictly immutable collections
		if(settings.immutableCollections && oldCollection === this.collection) return;

		if(this.boundViews === null) this.boundViews = [];

		if(this.boundViews.length === 0)
		{
			// Fast initial rendering:
			l = this.collection.length;
			if(l > 0)
			{
				a = this.collection;
				lastChild = this.anchor;
				if(this.anchor && this.anchor.parentNode)
				{
					parentNode = this.anchor.parentNode;
					for(i = 0; i < l; i++)
					{
						boundView = this.createBoundView(a[i]);
						this.boundViews[i].runAll();
						this.boundViews[i].afterRunAll();
						el = boundView.element;
						insertBefore(parentNode, lastChild.nextSibling, el);
						lastChild = el;
					}
				}
			}
		}
		else
		{
			// Diff based rendering:
			var newCollection = this.collection;
			var newBoundViews = [];
			var recycledViews = [];
			var oldCollectionKeyMap;
			var newCollectionKeyMap;
			if(this.keyProp)
			{
				oldCollectionKeyMap = {};
				for(i = 0, l = oldCollection.length; i < l; i++)
				{
					oldCollectionKeyMap[oldCollection[i][this.keyProp]] = i;
				}

				newCollectionKeyMap = {};
				for(i = 0, l = newCollection.length; i < l; i++)
				{
					newCollectionKeyMap[newCollection[i][this.keyProp]] = i;
				}
			}

			// Merge old and new bound view arrays:
			var tempBoundViews = [];
			for(i = 0, l = Math.max(oldCollection.length, newCollection.length); i < l; i++)
			{
				if(oldCollection[i] && getKeyedItemIndex(newCollection, oldCollection[i], this.keyProp, newCollectionKeyMap) === -1)
				{
					// Item is in the old collection but not in the new one
					boundView = this.boundViews[i];
					if(this.animate)
					{
						tempBoundViews.push(boundView);
						lastView = boundView;
					}
					else lastView = null;
					recycledViews.push(boundView);
				}
				if(newCollection[i])
				{
					// Item is in the new collection
					var oldIndex = getKeyedItemIndex(oldCollection, newCollection[i], this.keyProp, oldCollectionKeyMap);
					if(oldIndex !== -1)
					{
						// Item is already rendered, reuse its view
						boundView = this.boundViews[oldIndex];
						tempBoundViews.push(boundView);
						boundView.scope['*'] = this.cursor.refine([i]);
						if(this.view._itemAlias) boundView.scope[this.view._itemAlias] = boundView.scope['*'];
						boundView.setBindingIndex(i);
						newBoundViews.push(boundView);
						lastView = boundView;
					}
					else
					{
						// Item is new, create new binding view
						if(this.animate || recycledViews.length === 0)
						{
							boundView = this.createBoundView(newCollection[i]);
							boundView.scope['*'] = this.cursor.refine([i]);
							if(this.view._itemAlias) boundView.scope[this.view._itemAlias] = boundView.scope['*'];
							boundView.setBindingIndex(i);
							boundView.runAll();
							boundView.afterRunAll();
						}
						else
						{
							boundView = recycledViews.shift();
							boundView.scope['*'] = this.cursor.refine([i]);
							if(this.view._itemAlias) boundView.scope[this.view._itemAlias] = boundView.scope['*'];
							boundView.setBindingIndex(i);
						}
						tempBoundViews.push(boundView);
						newBoundViews.push(boundView);
						lastView = null;
					}
				}
			}

			if(lastView)
			{
				// Reordering elements from the last one:
				lastChild = lastView.element;
				i = tempBoundViews.length - 1;

				el = tempBoundViews[i].element;
				if(el !== lastChild && lastChild.parentNode && lastChild.parentNode.nodeType === 1 && el !== lastChild.nextSibling)
				{
					insertBefore(lastChild.parentNode, lastChild.nextSibling, el);
					lastChild = el;
				}

				for(; i >= 0; i--)
				{
					el = tempBoundViews[i].element;
					var nextSibling = el.nextSibling;
					if(el !== lastChild && nextSibling !== lastChild && lastChild.parentNode && lastChild.parentNode.nodeType === 1)
					{
						insertBefore(lastChild.parentNode, lastChild, el);
					}
					lastChild = el;
					tempBoundViews[i].refreshIndexedBinders(true);
				}
			}
			else
			{
				// Add elements after anchor text node:
				lastChild = this.anchor;
				if(this.anchor.parentNode)
				{
					parentNode = this.anchor.parentNode;
				}
				for(i = 0, l = tempBoundViews.length; i < l; i++)
				{
					el = tempBoundViews[i].element;

					if(el !== lastChild.nextSibling)
					{
						insertBefore(parentNode, lastChild.nextSibling, el);
					}
					tempBoundViews[i].refreshIndexedBinders(true);
					lastChild = el;
				}
			}
			this.boundViews = newBoundViews;

			// Remove old views:
			for(i = 0, l = recycledViews.length; i < l; i++)
			{
				var viewToRemove = recycledViews[i];
				if(viewToRemove.element && viewToRemove.element.parentNode)
				{
					removeNodeAsync(viewToRemove, removeChild);
				}
			}
		}
	}
743900
function cleanup() {
            // Need to do this in order to trigger the corresponding CloseLiveBrowser cleanups required on
            // the native Mac side
            var closeDeferred = (brackets.platform === "mac") ? NativeApp.closeLiveBrowser() : $.Deferred().resolve();
            closeDeferred.done(function () {
                _setStatus(STATUS_INACTIVE, reason || "explicit_close");
                // clean-up registered servers
                _regServers.forEach(function (server) {
                    LiveDevServerManager.removeServer(server);
                });
                _regServers = [];
                _closeDeferred.resolve();
            }).fail(function (err) {
                if (err) {
                    reason +=  " (" + err + ")";
                }
                _setStatus(STATUS_INACTIVE, reason || "explicit_close");
                _closeDeferred.resolve();
            });
        }
1203029
function () {
			var renderer = this;

			// Remove the canvas
			discardElement(renderer.canvas);

			// Kill the timer
			if (renderer.ttTimer !== UNDEFINED) {
				clearTimeout(renderer.ttTimer);
			}

			// Remove the divs for tooltip and line
			discardElement(renderer.ttLine);
			discardElement(renderer.ttDiv);
			discardElement(renderer.hiddenSvg);

			// Continue with base class
			return SVGRenderer.prototype.destroy.apply(renderer);
		}
168745
private void cleanup_event_filters() {
        Enumeration keys = event_callback_map.keys();
        while (keys.hasMoreElements()) {
            String name = (String) keys.nextElement();
            EventCallBackStruct callback_struct = event_callback_map.get(name);
            if (callback_struct.consumer instanceof NotifdEventConsumer) {
                try {
                    EventChannelStruct ec_struct = channel_map.get(callback_struct.channel_name);
                    Filter filter = ec_struct.structuredProxyPushSupplier.get_filter(callback_struct.filter_id);
                    ec_struct.structuredProxyPushSupplier.remove_filter(callback_struct.filter_id);
                    filter.destroy();
                } catch (FilterNotFound e) {
                    // Do nothing
                }
            }
        }
    }
945075
function() {
        if (!this.mapDiv) { // we've already been destroyed
            return;
        }
        if (this.handlers.click) {
            this.handlers.click.destroy();
        }
        if (this.handlers.drag) {
            this.handlers.drag.destroy();
        }

        this.ovmap && this.ovmap.viewPortDiv.removeChild(this.extentRectangle);
        this.extentRectangle = null;

        if (this.rectEvents) {
            this.rectEvents.destroy();
            this.rectEvents = null;
        }

        if (this.ovmap) {
            this.ovmap.destroy();
            this.ovmap = null;
        }
        
        this.element.removeChild(this.mapDiv);
        this.mapDiv = null;

        this.div.removeChild(this.element);
        this.element = null;

        if (this.maximizeDiv) {
            this.div.removeChild(this.maximizeDiv);
            this.maximizeDiv = null;
        }
        
        if (this.minimizeDiv) {
            this.div.removeChild(this.minimizeDiv);
            this.minimizeDiv = null;
        }

        this.map.events.un({
            buttonclick: this.onButtonClick,
            moveend: this.update,
            changebaselayer: this.baseLayerDraw,
            scope: this
        });

        OpenLayers.Control.prototype.destroy.apply(this, arguments);    
    }
510021
public void destroyCleanupTerminatedInstanceTimer() {
        cleanupTerminatedInstancesScheduledFuture.cancel(true);
        cleanupTerminatedInstancesScheduledFuture = null;
        cleanupTerminatedInstancesTimer.shutdown();
        cleanupTerminatedInstancesTimer = null;
    }
1100506
function(oExtension) {
			if (oExtension._cleanupInfo) {
				oExtension._cleanupInfo.cell.attr(oExtension._cleanupInfo.attr);
				oExtension._cleanupInfo = null;
			}
		}
683098
function () {
        var cleanup = function () {
            u.off(this.element,'transitionend', cleanup);
            // this.element.removeEventListener('transitionend', cleanup);
            u.off(this.element,'webkitTransitionEnd', cleanup);
            // this.element.removeEventListener('webkitTransitionEnd', cleanup);
            u.removeClass(this.element, 'is-animating');
        }.bind(this);

        // Remove animation class once the transition is done.
        u.on(this.element,'transitionend', cleanup);
        // this.element.addEventListener('transitionend', cleanup);
        u.on(this.element,'webkitTransitionEnd', cleanup);
        // this.element.addEventListener('webkitTransitionEnd', cleanup);
    }