fenster
fenster copied to clipboard
Opening multiple windows in series not working (OSX)
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 thewhileloop (fenster_close()) never gets called! - If I change the
whileloop to be:while (t < 1000 && fenster_loop(&f) == 0)and then wait fortto reach 1000- the first instance runs OK to completion (including the
fenster_close()) - but the second call to
run()immediately causes a segfault.
- the first instance runs OK to completion (including the
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).