mirror of https://github.com/xzeldon/htop.git
Don't end up killing init if process selected to be killed terminates before the user selects a signal. Closes #3606072.
This commit is contained in:
parent
a0810561f3
commit
ee5dc46fee
|
@ -173,7 +173,8 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
|
||||||
for (int i = 0; i < this->panelCount; i++) {
|
for (int i = 0; i < this->panelCount; i++) {
|
||||||
Panel* panel = (Panel*) Vector_get(this->panels, i);
|
Panel* panel = (Panel*) Vector_get(this->panels, i);
|
||||||
if (mevent.x > panel->x && mevent.x <= panel->x+panel->w &&
|
if (mevent.x > panel->x && mevent.x <= panel->x+panel->w &&
|
||||||
mevent.y > panel->y && mevent.y <= panel->y+panel->h) {
|
mevent.y > panel->y && mevent.y <= panel->y+panel->h &&
|
||||||
|
(this->allowFocusChange || panelFocus == panel) ) {
|
||||||
focus = i;
|
focus = i;
|
||||||
panelFocus = panel;
|
panelFocus = panel;
|
||||||
Panel_setSelected(panel, mevent.y - panel->y + panel->scrollV - 1);
|
Panel_setSelected(panel, mevent.y - panel->y + panel->scrollV - 1);
|
||||||
|
|
9
htop.c
9
htop.c
|
@ -217,9 +217,10 @@ static Object* pickFromVector(Panel* panel, Panel* list, int x, int y, const cha
|
||||||
Panel* panelFocus;
|
Panel* panelFocus;
|
||||||
int ch;
|
int ch;
|
||||||
bool unfollow = false;
|
bool unfollow = false;
|
||||||
if (header->pl->following == -1) {
|
|
||||||
Process* p = (Process*)Panel_getSelected(panel);
|
Process* p = (Process*)Panel_getSelected(panel);
|
||||||
header->pl->following = p ? p->pid : -1;
|
int pid = p ? p->pid : -1;
|
||||||
|
if (header->pl->following == -1) {
|
||||||
|
header->pl->following = pid;
|
||||||
unfollow = true;
|
unfollow = true;
|
||||||
}
|
}
|
||||||
ScreenManager_run(scr, &panelFocus, &ch);
|
ScreenManager_run(scr, &panelFocus, &ch);
|
||||||
|
@ -231,7 +232,11 @@ static Object* pickFromVector(Panel* panel, Panel* list, int x, int y, const cha
|
||||||
Panel_resize(panel, COLS, LINES-y-1);
|
Panel_resize(panel, COLS, LINES-y-1);
|
||||||
FunctionBar_draw(prevBar, NULL);
|
FunctionBar_draw(prevBar, NULL);
|
||||||
if (panelFocus == list && ch == 13) {
|
if (panelFocus == list && ch == 13) {
|
||||||
|
Process* selected = (Process*)Panel_getSelected(panel);
|
||||||
|
if (selected->pid == pid)
|
||||||
return Panel_getSelected(list);
|
return Panel_getSelected(list);
|
||||||
|
else
|
||||||
|
beep();
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue