cv.makeCtxCurrent();
    private void removeCtx(Canvas3D cv, long display, int window, long ctx,			   boolean resetCtx, boolean freeBackground, 			   boolean destroyOffScreenBuffer) {		synchronized (VirtualUniverse.mc.contextCreationLock) {	    // Fix for issue 18.	    // Since we are now the renderer thread, 	    // we can safely execute destroyOffScreenBuffer.	    if(destroyOffScreenBuffer) {		cv.makeCtxCurrent();		cv.destroyOffScreenBuffer(ctx, display, cv.fbConfig, window);	    }	    if (ctx != 0) {		int idx = listOfCtxs.indexOf(new Long(ctx));		if (idx >= 0) {		    listOfCtxs.remove(idx);		    listOfCanvases.remove(idx);		    // display is always 0 under windows		    if ((MasterControl.isWin32 || (display != 0)) && 			(window != 0) && cv.added) {			// cv.ctx may reset to -1 here so we			// always use the ctx pass in.			if (cv.drawingSurfaceObject.renderLock()) {			    // if it is the last one, free shared resources			    if (sharedCtx != 0) {				if (listOfCtxs.isEmpty()) {				    makeCtxCurrent(sharedCtx, display, window);				    freeResourcesInFreeList(null);				    freeContextResources();				    Canvas3D.destroyContext(display, window, sharedCtx);				    currentCtx = -1;				} else {				    freeResourcesInFreeList(cv);				}				cv.makeCtxCurrent(ctx, display, window);			    } else {				cv.makeCtxCurrent(ctx, display, window);				cv.freeResourcesInFreeList(ctx);			    }			    cv.freeContextResources(this, freeBackground, ctx);			    Canvas3D.destroyContext(display, window, ctx);			    currentCtx = -1;			    cv.drawingSurfaceObject.unLock();			}		    }		}		if (resetCtx) {		    cv.ctx = 0;		}		if ((sharedCtx != 0) && listOfCtxs.isEmpty()) {		    sharedCtx = 0;		    sharedCtxTimeStamp = 0;		}		cv.ctxTimeStamp = 0;	    }	}    }