# Program crashes when removing actors

**URL:** https://discourse.vtk.org/t/program-crashes-when-removing-actors/4470
**Category:** Support
**Created:** [October 22, 2020, 9:44am UTC](https://discourse.vtk.org/t/program-crashes-when-removing-actors/4470 "2020-10-22T09:44:12Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Daniel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/d/3ec8ea/32.png) [@Daniel](https://discourse.vtk.org/u/Daniel)
#### Post date: [October 22, 2020, 9:44am UTC](https://discourse.vtk.org/t/program-crashes-when-removing-actors/4470/1 "2020-10-22T09:44:12Z")

</div>

Hello everybody,  
I try to remove actors from the renderer, but my program always crashes.  
the following **error message** appears:

`vtkWin32OpenGLRenderWin:217 ERR| vtkWin32OpenGLRenderWindow (0000000027348C40): wglMakeCurrent failed in MakeCurrent(), error: The requested resource is already in use.`  
_#_  
_# A fatal error has been detected by the Java Runtime Environment:_  
_#_  
_# EXCEPTION\_ACCESS\_VIOLATION (0xc0000005) at pc=0x00007ffdf99de33d, pid=3760, tid=0x0000000000004278_  
_#_  
_# JRE version: Java™ SE Runtime Environment (8.0\_181-b13) (build 1.8.0\_181-b13)_  
_# Java VM: Java HotSpot™ 64-Bit Server VM (25.181-b13 mixed mode windows-amd64 compressed oops) …_

The crash happens within this **code snippet** :

public void Clear3DView() {

```
	vtkActorCollection actors = this.ren.GetActors();
	vtkPropCollection props = ren.GetViewProps();
	
	vtkActor lastActor = actors.GetLastActor();		
	
	System.out.println(" Actors = "+actors.GetNumberOfItems());
	System.out.println(" Props = "+props.GetNumberOfItems());
	
	try {
		ren.RemoveActor(lastActor); // Crash
	} catch (Exception e) {
		e.printStackTrace();
	}
	
	this.ren.ResetCamera();
	this.ren.ResetCameraClippingRange(); 
	this.ren.InteractiveOff();
	this.validate();
	this.repaint();
}

```

Seems to be a issue with java.  
Does anyone have an idea what this is due to or how do I fix it?

---

<div class="post-metadata">

### Author: ![Daniel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/d/3ec8ea/32.png) [@Daniel](https://discourse.vtk.org/u/Daniel)
#### Post date: [July 7, 2021, 2:55pm UTC](https://discourse.vtk.org/t/program-crashes-when-removing-actors/4470/2 "2021-07-07T14:55:23Z")

</div>

Hi there,

in another application, removing actors was not a problem.  
Now I use JavaFX in addition to Java and in this application no actors can be removed as described above.  
Anyone know advice?
