fixed a signal handling bug in QSE::App

This commit is contained in:
hyung-hwan 2019-11-12 07:08:24 +00:00
parent 4ee4169619
commit ae997bb477

View File

@ -392,7 +392,7 @@ int App::set_signal_subscription_no_mutex (int sig, SignalState reqstate, bool i
if (reqstate == SIGNAL_NEGLECTED) if (reqstate == SIGNAL_NEGLECTED)
{ {
// accepted/discarded -> neglected(unhandled) // accepted/discarded->neglected(unhandled)
QSE_ASSERT (g_app_sig[sig] != QSE_NULL); QSE_ASSERT (g_app_sig[sig] != QSE_NULL);
if (g_app_sig[sig] == this) if (g_app_sig[sig] == this)
@ -415,14 +415,14 @@ int App::set_signal_subscription_no_mutex (int sig, SignalState reqstate, bool i
} }
else if (QSE_LIKELY(sl._state == SIGNAL_NEGLECTED)) else if (QSE_LIKELY(sl._state == SIGNAL_NEGLECTED))
{ {
// neglected(unhandled) -> accepted/discarded // neglected(unhandled)->accepted/discarded
QSE_ASSERT (sl._prev == QSE_NULL && sl._next == QSE_NULL); QSE_ASSERT (sl._prev == QSE_NULL && sl._next == QSE_NULL);
App* xapp = g_app_sig[sig]; App* xapp = g_app_sig[sig];
App* xapp_xprev = QSE_NULL; App* xapp_xprev = QSE_NULL;
g_app_sig[sig] = this; g_app_sig[sig] = this;
sl._state = SIGNAL_ACCEPTED; sl._state = reqstate;
sl._next = xapp; sl._next = xapp;
if (xapp) if (xapp)
{ {
@ -449,7 +449,7 @@ int App::set_signal_subscription_no_mutex (int sig, SignalState reqstate, bool i
} }
else else
{ {
// accpeted/ignored -> ignored/accepted // accpeted->discarded or discarded->accepted
QSE_ASSERT (g_app_sig[sig] != QSE_NULL); QSE_ASSERT (g_app_sig[sig] != QSE_NULL);
sl._state = reqstate; sl._state = reqstate;
} }