Execute the detaching event.

@param oldplot Plot to detach from.
964944
private void detachPlot(SVGPlot oldplot) {
    if(oldplot == null) {
      return;
    }
    this.plot = null;
    oldplot.unsynchronizeWith(synchronizer);
  }
988058
public void processEvent(SystemEvent event)
    {
        Map<String, Object> scope = null;
        
        if (event instanceof PreDestroyViewMapEvent)
        {
            UIViewRoot viewRoot = (UIViewRoot) ((PreDestroyViewMapEvent) event).getComponent();
            scope = viewRoot.getViewMap(false);
            if (scope == null)
            {
                // view map does not exist --> nothing to destroy
                return;
            }
        }
        else if (event instanceof PreDestroyCustomScopeEvent)
        {
            ScopeContext scopeContext = ((PreDestroyCustomScopeEvent) event).getContext();
            scope = scopeContext.getScope();
        }
        else
        {
            // wrong event
            return;
        }
        
        if (!scope.isEmpty())
        {
            Set<String> keySet = scope.keySet();
            String[] keys = keySet.toArray(new String[keySet.size()]);
            
            for (String key : keys)
            {
                Object value = scope.get(key);
                this.destroy(key, value);
            }
        }
    }
799352
private void release() {
        try {
            Method release = BoundObjectTable.Table.class.getDeclaredMethod("release", String.class);
            release.setAccessible(true);
            release.invoke(boundObjectTable, boundId);
        } catch (Exception x) {
            LOG.log(Level.WARNING, "failed to unbind " + boundId, x);
        }
    }
1222867
protected void fireLayerRemoveAllEvent(List<? extends L> removedObjects) {
		fireLayerHierarchyChangedEvent(
				new MapLayerHierarchyEvent(
						this,
						removedObjects,
						Type.REMOVE_ALL_CHILDREN,
						-1,
						isTemporaryLayer()));
	}
1100188
def _trigger_refresh(self, key):
        ""
        # Update if not top-level, batched or an ElementPlot
        if not self.top_level or isinstance(self, GenericElementPlot):
            self.update(key)
518680
function (keepEvents) {
		var axis = this,
			stacks = axis.stacks,
			stackKey,
			plotLinesAndBands = axis.plotLinesAndBands,
			i;

		// Remove the events
		if (!keepEvents) {
			removeEvent(axis);
		}

		// Destroy each stack total
		for (stackKey in stacks) {
			destroyObjectProperties(stacks[stackKey]);

			stacks[stackKey] = null;
		}

		// Destroy collections
		each([axis.ticks, axis.minorTicks, axis.alternateBands], function (coll) {
			destroyObjectProperties(coll);
		});
		i = plotLinesAndBands.length;
		while (i--) { // #1975
			plotLinesAndBands[i].destroy();
		}

		// Destroy local variables
		each(['stackTotalGroup', 'axisLine', 'axisGroup', 'gridGroup', 'labelGroup', 'axisTitle'], function (prop) {
			if (axis[prop]) {
				axis[prop] = axis[prop].destroy();
			}
		});
	}
302047
function (event) {
		var chart = this,
			hasZoomed,
			pointer = chart.pointer,
			displayButton = false,
			resetZoomButton;

		// If zoom is called with no arguments, reset the axes
		if (!event || event.resetSelection) {
			each(chart.axes, function (axis) {
				hasZoomed = axis.zoom();
			});
		} else { // else, zoom in on all axes
			each(event.xAxis.concat(event.yAxis), function (axisData) {
				var axis = axisData.axis,
					isXAxis = axis.isXAxis;

				// don't zoom more than minRange
				if (pointer[isXAxis ? 'zoomX' : 'zoomY'] || pointer[isXAxis ? 'pinchX' : 'pinchY']) {
					hasZoomed = axis.zoom(axisData.min, axisData.max);
					if (axis.displayBtn) {
						displayButton = true;
					}
				}
			});
		}
		
		// Show or hide the Reset zoom button
		resetZoomButton = chart.resetZoomButton;
		if (displayButton && !resetZoomButton) {
			chart.showResetZoom();
		} else if (!displayButton && isObject(resetZoomButton)) {
			chart.resetZoomButton = resetZoomButton.destroy();
		}
		

		// Redraw
		if (hasZoomed) {
			chart.redraw(
				pick(chart.options.chart.animation, event && event.animation, chart.pointCount < 100) // animation
			);
		}
	}
1229301
public void removeFigure(Figure figure) {
		figures.remove(figure);
		figureMap.remove(figure.getData().getAttribute("id"));
	}
19330
def cleanup(self):
        
        plots = self.traverse(lambda x: x, [BokehPlot])
        for plot in plots:
            if not isinstance(plot, (GenericCompositePlot, GenericElementPlot, GenericOverlayPlot)):
                continue
            streams = list(plot.streams)
            plot.streams = []
            plot._document = None

            if plot.subplots:
                plot.subplots.clear()

            if isinstance(plot, GenericElementPlot):
                for callback in plot.callbacks:
                    streams += callback.streams
                    callback.cleanup()

            for stream in set(streams):
                stream._subscribers = [
                    (p, subscriber) for p, subscriber in stream._subscribers
                    if get_method_owner(subscriber) not in plots
                ]

        if self.comm and self.root is self.handles.get('plot'):
            self.comm.close()
1065513
static void detach() {
        map.get().kill();
        try {
          map.get().join();
        } catch (InterruptedException e) {
          Thread.currentThread().interrupt();
        }
        map.remove();
    }
1040184
public void removeScatterPlot(String scatterID) throws ShanksException {
        Scenario3DPortrayal scenarioPortrayal = (Scenario3DPortrayal) this
                .getSimulation().getScenarioPortrayal();
        scenarioPortrayal.removeScatterPlot(scatterID);
    }
368374
def clear_plot(self):
        """"""
        self.tab_plot.clear()
        self.tab_plot.draw()
        self.save_plot.set_enabled(False)
414339
function (oldEvt) {
    var el = this.el;
    if (oldEvt) { el.removeEventListener(oldEvt, this.playSoundBound); }
    el.addEventListener(this.data.on, this.playSoundBound);
  }
1223309
public void run(Runnable r) {
    Context previous = attach();
    try {
      r.run();
    } finally {
      detach(previous);
    }
  }
60663
protected void triggerSubplotSelectEvent(PlotItem it) {
    // forward event to all listeners.
    for(ActionListener actionListener : actionListeners) {
      actionListener.actionPerformed(new DetailViewSelectedEvent(this, ActionEvent.ACTION_PERFORMED, null, 0, it));
    }
  }
611823
public void detach() {
        if (listener != null) {
            contextFactory.removeListener(listener);
            contextFactory = null;
            listener = null;
        }
    }
764044
@Deprecated
    public void removeData(C data) {
        Preconditions.checkState(mGroupBasicAdapter != null, "Must call bindView() first");
        this.mGroupBasicAdapter.removeGroup(data);
    }