mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-10 13:32:31 +03:00
Ticket #2333: MC hangs after exit
On some FreeBSD servers with tcsh shell the following bug occurs sometimes: trying to exit from mc it hangs. More detail: 1. run mc, press F10, press Enter - hangs 2. run mc, press F10, choose Command->File->Exit - NOT hangs. This hang up is a result of subshell_chdir() call after subshell close (after exit_subshell() call). When the F10 key is handled in dlg_try_hotkey() function, the do_select_widget() is called. As a result, the WIDGET_FOCUS message is sent to the active panel and panel calls subshell_chdir(). But subshell is already closed at this moment and midnight_dlg is in DLG_CLOSED state. The solution: don't send DLG_DRAW, DLG_FOCUS and DLG_UNFOCUS messages to the inactive dialog (that is not in DLG_ACTIVE state). Since dialog is about destroying (in DLG_CLOSED state) or not visible in screen (in DLG_SUSPENDED state) it is not needed in any visual changes. Thanks Tempread for investigation of the problem root. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
54f10a98d9
commit
cde7a850d5
18
src/dialog.c
18
src/dialog.c
@ -106,17 +106,20 @@ widget_erase (Widget * w)
|
||||
|
||||
/* Clean the dialog area, draw the frame and the title */
|
||||
void
|
||||
common_dialog_repaint (struct Dlg_head *h)
|
||||
common_dialog_repaint (Dlg_head *h)
|
||||
{
|
||||
int space;
|
||||
|
||||
if (h->state != DLG_ACTIVE)
|
||||
return;
|
||||
|
||||
space = (h->flags & DLG_COMPACT) ? 0 : 1;
|
||||
|
||||
tty_setcolor (DLG_NORMALC (h));
|
||||
dlg_erase (h);
|
||||
draw_box (h, space, space, h->lines - 2 * space, h->cols - 2 * space, FALSE);
|
||||
|
||||
if (h->title)
|
||||
if (h->title != NULL)
|
||||
{
|
||||
tty_setcolor (DLG_HOT_NORMALC (h));
|
||||
dlg_move (h, space, (h->cols - str_term_width1 (h->title)) / 2);
|
||||
@ -317,7 +320,7 @@ dlg_set_default_colors (void)
|
||||
void
|
||||
dlg_erase (Dlg_head * h)
|
||||
{
|
||||
if (h != NULL)
|
||||
if ((h != NULL) && (h->state == DLG_ACTIVE))
|
||||
tty_fill_region (h->y, h->x, h->lines, h->cols, ' ');
|
||||
}
|
||||
|
||||
@ -458,7 +461,7 @@ dlg_focus (Dlg_head * h)
|
||||
{
|
||||
/* cannot focus disabled widget ... */
|
||||
|
||||
if (h->current != NULL)
|
||||
if ((h->current != NULL) && (h->state == DLG_ACTIVE))
|
||||
{
|
||||
Widget *current = (Widget *) h->current->data;
|
||||
|
||||
@ -478,7 +481,7 @@ dlg_unfocus (Dlg_head * h)
|
||||
{
|
||||
/* ... but can unfocus disabled widget */
|
||||
|
||||
if (h->current != NULL)
|
||||
if ((h->current != NULL) && (h->state == DLG_ACTIVE))
|
||||
{
|
||||
Widget *current = (Widget *) h->current->data;
|
||||
|
||||
@ -649,7 +652,7 @@ update_cursor (Dlg_head * h)
|
||||
{
|
||||
GList *p = h->current;
|
||||
|
||||
if (p != NULL)
|
||||
if ((p != NULL) && (h->state == DLG_ACTIVE))
|
||||
{
|
||||
Widget *w;
|
||||
|
||||
@ -683,6 +686,9 @@ update_cursor (Dlg_head * h)
|
||||
void
|
||||
dlg_redraw (Dlg_head * h)
|
||||
{
|
||||
if (h->state != DLG_ACTIVE)
|
||||
return;
|
||||
|
||||
if (h->winch_pending)
|
||||
{
|
||||
h->winch_pending = FALSE;
|
||||
|
@ -253,7 +253,7 @@ void init_widget (Widget * w, int y, int x, int lines, int cols,
|
||||
cb_ret_t default_dlg_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *data);
|
||||
|
||||
/* Default paint routine for dialogs */
|
||||
void common_dialog_repaint (struct Dlg_head *h);
|
||||
void common_dialog_repaint (Dlg_head *h);
|
||||
|
||||
#define widget_move(w, _y, _x) tty_gotoyx (((Widget *)(w))->y + _y, ((Widget *)(w))->x + _x)
|
||||
#define dlg_move(h, _y, _x) tty_gotoyx (((Dlg_head *)(h))->y + _y, ((Dlg_head *)(h))->x + _x)
|
||||
|
Loading…
Reference in New Issue
Block a user