Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save record before exit on SIGTERM/SIGINT signals #960

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/GUI/PageRecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,12 +761,25 @@ void PageRecord::StopPage(bool save) {

}

PageRecord* g_pagerecord_obj;
void OnExitSignal(int signum) {
if(g_pagerecord_obj)
g_pagerecord_obj->OnRecordSave(false);

exit(signum);
}

void PageRecord::StartOutput() {
assert(m_page_started);

if(m_output_started)
return;

// register exit signals handlers
g_pagerecord_obj = this;
signal(SIGTERM, OnExitSignal);
signal(SIGINT, OnExitSignal);

#if SSR_USE_ALSA
if(m_simple_synth != NULL) {
m_simple_synth->PlaySequence(SEQUENCE_RECORD_START.data(), SEQUENCE_RECORD_START.size());
Expand Down