enforce singleton across both direct and rendered mode #1694

This commit is contained in:
nick black 2021-06-01 17:41:14 -04:00 committed by Nick Black
parent d170e6e7a2
commit 3ac445a328
2 changed files with 8 additions and 6 deletions

View File

@ -22,6 +22,10 @@ rearrangements of Notcurses.
* Sadly, `ncplane_contents()` no longer accepts a `const ncplane*`, since it
might write temporaries to the plane's EGCpool during operation.
* Added `ncdirect_styles()`, to retrieve the current styling.
* In previous versions of Notcurses, a rendered-mode context
(`struct notcurses`) and a direct-mode context (`struct ncdirect`) could
be open at the same time. This was never intended, and is no longer
possible.
* 2.3.1 (2021-05-18)
* Sprixels no longer interact with their associated plane's framebuffer. This

View File

@ -111,12 +111,10 @@ int setup_signals(void* vnc, bool no_quit_sigs, bool no_winch_sig,
void* expected = NULL;
struct sigaction sa;
// don't register ourselves if we don't intend to set up signal handlers
if(!no_winch_sig || !no_quit_sigs){
// we expect NULL (nothing registered), and want to register nc
if(!atomic_compare_exchange_strong(&signal_nc, &expected, nc)){
loginfo(nc, "%p is already registered for signals (provided %p)\n", expected, nc);
return -1;
}
// we expect NULL (nothing registered), and want to register nc
if(!atomic_compare_exchange_strong(&signal_nc, &expected, nc)){
loginfo(nc, "%p is already registered for signals (provided %p)\n", expected, nc);
return -1;
}
if(!no_winch_sig){
memset(&sa, 0, sizeof(sa));