Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 269106
b: refs/heads/master
c: 3f7247e
h: refs/heads/master
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed Oct 18, 2011
1 parent d980caa commit 5967561
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2d5646c0d58697c63e1fe6f227165637ca04a6c4
refs/heads/master: 3f7247e0725de9643ce5a02b082c81c617476fd5
24 changes: 23 additions & 1 deletion trunk/tools/perf/util/ui/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "browser.h"
#include "helpline.h"
#include "ui.h"
#include "libslang.h"

pthread_mutex_t ui__lock = PTHREAD_MUTEX_INITIALIZER;

Expand All @@ -17,6 +18,21 @@ static void newt_suspend(void *d __used)
newtResume();
}

static void ui__exit(void)
{
SLtt_set_cursor_visibility(1);
SLsmg_refresh();
SLsmg_reset_smg();
SLang_reset_tty();
}

static void ui__signal(int sig)
{
ui__exit();
psignal(sig, "perf");
exit(0);
}

void setup_browser(bool fallback_to_pager)
{
if (!isatty(1) || !use_browser || dump_trace) {
Expand All @@ -32,6 +48,12 @@ void setup_browser(bool fallback_to_pager)
newtSetSuspendCallback(newt_suspend, NULL);
ui_helpline__init();
ui_browser__init();

signal(SIGSEGV, ui__signal);
signal(SIGFPE, ui__signal);
signal(SIGINT, ui__signal);
signal(SIGQUIT, ui__signal);
signal(SIGTERM, ui__signal);
}

void exit_browser(bool wait_for_ok)
Expand All @@ -41,6 +63,6 @@ void exit_browser(bool wait_for_ok)
char title[] = "Fatal Error", ok[] = "Ok";
newtWinMessage(title, ok, ui_helpline__last_msg);
}
newtFinished();
ui__exit();
}
}

0 comments on commit 5967561

Please sign in to comment.