From patchwork Wed May 13 13:33:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 6697 Received: (qmail 16489 invoked by alias); 13 May 2015 13:33:32 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 16442 invoked by uid 89); 13 May 2015 13:33:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: mail-qc0-f174.google.com Received: from mail-qc0-f174.google.com (HELO mail-qc0-f174.google.com) (209.85.216.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 13 May 2015 13:33:30 +0000 Received: by qcbgu10 with SMTP id gu10so22124517qcb.2 for ; Wed, 13 May 2015 06:33:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ckiTnk9BJeodP+VVrO3t9N9OX/PVjJUNrxlAa2fyRQQ=; b=lmwRGCgrii26dr4zIy0TcPjTathDtBpK+Gl9Fo+2z2a9Ngd1togqF41ULG5z+bhvwQ ig8G1FQ4AXxTHsPZkyrktDRX/a5Jb5yuJhlIgRtwh7+ulwf62HcS+cm5DpjM561gwgjb XvFzcv1LDsdCILl5WhPoMaM83Uj2YBwXIK67f7vdBlwYFOf1s4EBHlHNlBhmH0PFd9bm urK65nRO9Os7ueHLnQRNPsy3SYANzZgQ8wkhynYvkTDWgmI/GFPE1H7109POg0PzBvbK FWwSKvQFpAHNG0oa2m+zom+Ipoa0Z98UGAjHMsmxiHf0/mZ6T8G2bf4/UEXOEuFNeK+u RsFQ== X-Gm-Message-State: ALoCoQmmLHpj2AgV9GPykUYebrNtgICoXF3g0gXWkVJezK0twgM6pGKdQ5a8VVv6rUWE/AiHn+wU X-Received: by 10.140.146.142 with SMTP id 136mr28211247qhs.31.1431524008374; Wed, 13 May 2015 06:33:28 -0700 (PDT) Received: from localhost.localdomain (ool-4353acd8.dyn.optonline.net. [67.83.172.216]) by mx.google.com with ESMTPSA id w92sm15690747qgd.47.2015.05.13.06.33.27 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 May 2015 06:33:27 -0700 (PDT) From: Patrick Palka To: gdb-patches@sourceware.org Cc: Patrick Palka Subject: [PATCH] Avoid race condition when handling a SIGWINCH signal Date: Wed, 13 May 2015 09:33:20 -0400 Message-Id: <1431524000-21098-1-git-send-email-patrick@parcs.ath.cx> The control variable win_resized must be cleared before responding to it. Otherwise there is a small window where another SIGWINCH might occur in between the handling of an earlier SIGWINCH and the clearing of win_resized, at which point win_resized would be set (again) by the signal handler. Shortly thereafter we would clear win_resized even though we only handled the earlier SIGWINCH but not the latest one. This chain of events is all avoided if we clear win_resized first. gdb/ChangeLog: * tui/tui-win.c (tui_async_resize_screen): Clear win_resized first before resizing the window. * tui.c (tui_enable): Likewise. --- gdb/tui/tui-win.c | 2 +- gdb/tui/tui.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 683c0ed..8c0685b 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -858,10 +858,10 @@ tui_async_resize_screen (gdb_client_data arg) } else { + tui_set_win_resized_to (FALSE); tui_resize_all (); tui_refresh_all_win (); tui_update_gdb_sizes (); - tui_set_win_resized_to (FALSE); tui_redisplay_readline (); } } diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index 9fac06e..b04e106 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -492,8 +492,8 @@ tui_enable (void) window. */ if (tui_win_resized ()) { - tui_resize_all (); tui_set_win_resized_to (FALSE); + tui_resize_all (); } if (deprecated_safe_get_selected_frame ())