fenster icon indicating copy to clipboard operation
fenster copied to clipboard

Opening multiple windows in series not working (OSX)

Open coolbutuseless opened this issue 2 years ago • 1 comments

Under OSX (12.6.3), I'm trying to open a second window after the first has closed.

In examples/minimal-c/main.c I've edited the main to be:

int main() { 
	printf("Starting first instance\n");
	run();
	printf("Starting second instance\n");
	return run(); 
}

After the first window opens and I click "close", the executable exits and the second instance never starts.

The console output I see is:

$ ./main
Starting first instance
$

What I've found so far:

  • closing the window by clicking the close icon terminates the executable immediatly - i.e. in the run() function the next line after the while loop (fenster_close()) never gets called!
  • If I change the while loop to be: while (t < 1000 && fenster_loop(&f) == 0) and then wait for t to reach 1000
    • the first instance runs OK to completion (including the fenster_close())
    • but the second call to run() immediately causes a segfault.

coolbutuseless avatar Feb 17 '23 22:02 coolbutuseless

This seems to be an expected behavior, since there is nothing to handle the attempt to close the window on either platform. On linux, the program is terminated when it receives an error from Xorg, when trying to close the window (yes, it returns non-zero error code when closing on close window button).

vaguinerg avatar Oct 14 '24 15:10 vaguinerg