fair-acc/chart-fx

Application does not exit with chartfx

PavelSpiridonov opened this issue · 4 comments

Discussed in #467

Originally posted by DennisOlbrich September 28, 2021
If any gsi XYchart is used in the FX application, the application will not close, when the last window is closed. Do you have any idea what is wrong?

`package application;

import de.gsi.chart.XYChart;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;

public class XYChartMain extends Application {

@Override
public void start(Stage primaryStage) throws Exception {
	XYChart chart = new XYChart();

	AnchorPane ap = new AnchorPane();
	ap.getChildren().add(chart);

	Scene scene = new Scene(ap, 640, 480);
	primaryStage.setScene(scene);

	primaryStage.show();
}

public static void main(String[] args) {
	// TODO Auto-generated method stub
	launch(args);
}

}`

Try adding

primaryStage.setOnCloseRequest((e) -> {
	System.exit(0);
});
ennerf commented

@wirew0rm It looks like this issue was fixed somewhere with the layout changes. The provided sample code now closes properly on main.

Going though the samples to narrow the problem down, these are still affected:

  • Histogram2DimSample
  • WaterfallPerformanceSample (even after removing ProfilerInfoBox)

So that narrows it down

EDIT: One reason seems to be the ProfilerInfobox. Disabling that one fixed some of the Samples (all above still have problems):

  • ChartIndicatorSample
  • DataViewerSample
  • DataViewerSample
  • ErrorDataSetRendererSample
  • RollingBufferSample

Removing SimplePerformanceMeter fixed:

  • RollingBufferSortedTreeSample
  • OscilloscopeAxisSample

Deamonise updater threads:

  • PaddedGrowAxis

If I delete the 2 remaining samples (2d histogram and Waterfall) the sampler also closes properly.

EDIT2:
The waterfall problem is caused somewhere in the midi datasource and the Histogram was caused by calling runFx from the update timer that was already on the FX thread. So I think this can be considered closed, Since the problem does not occur in the library anymore but is only caused by samples.
I'll try to repair the stuff I had to comment out to get a fixed PR.

closed as the original Problem seems to be solved. The samples will be fixed by a followup PR