zserge / fenster

The most minimal cross-platform GUI library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Opening multiple windows in series not working (OSX)

coolbutuseless opened this issue · comments

commented

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.