From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#44313: 27.1.50; ns_mouse_position EXC_BAD_ACCESS crash Date: Fri, 30 Oct 2020 22:35:21 +0000 Message-ID: <20201030223521.GL59267@breton.holly.idiocy.org> References: <83o8kkb2vr.fsf@gnu.org> <83a6w4ar50.fsf@gnu.org> <83imara6v0.fsf@gnu.org> <83eelfa5x9.fsf@gnu.org> <83a6w3a2xc.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2696"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 44313@debbugs.gnu.org, Aaron Jensen To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 30 23:36:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kYd0F-0000dK-WC for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 30 Oct 2020 23:36:12 +0100 Original-Received: from localhost ([::1]:57180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYd0F-00016U-2Y for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 30 Oct 2020 18:36:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48682) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYd06-00015X-0f for bug-gnu-emacs@gnu.org; Fri, 30 Oct 2020 18:36:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48521) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kYd05-0007QC-NF for bug-gnu-emacs@gnu.org; Fri, 30 Oct 2020 18:36:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kYd05-0003jU-KB for bug-gnu-emacs@gnu.org; Fri, 30 Oct 2020 18:36:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 30 Oct 2020 22:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44313 X-GNU-PR-Package: emacs Original-Received: via spool by 44313-submit@debbugs.gnu.org id=B44313.160409733314314 (code B ref 44313); Fri, 30 Oct 2020 22:36:01 +0000 Original-Received: (at 44313) by debbugs.gnu.org; 30 Oct 2020 22:35:33 +0000 Original-Received: from localhost ([127.0.0.1]:60067 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYczc-0003io-MC for submit@debbugs.gnu.org; Fri, 30 Oct 2020 18:35:32 -0400 Original-Received: from wilbur.contactoffice.com ([212.3.242.68]:36914) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYcza-0003iZ-RJ for 44313@debbugs.gnu.org; Fri, 30 Oct 2020 18:35:31 -0400 Original-Received: from smtpauth1.co-bxl (smtpauth1.co-bxl [10.2.0.15]) by wilbur.contactoffice.com (Postfix) with ESMTP id 3495B21BD; Fri, 30 Oct 2020 23:35:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1604097325; s=20200222-6h9o; d=idiocy.org; i=alan@idiocy.org; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:Content-Type:In-Reply-To; l=2471; bh=vx3K8HOSstp5+uDUNO6z9RfNpoz/Sx9CtHna907iAc8=; b=qbyRKFmEOYo5cC/WyW3gV0EKkxDWqpYbeNDH1Pt6xAR9YjA8iqXB+H7EcUxhSX6F 1S5aJefDBLmvfmHotO4dJL7IA7gWpKmFuDxMJHFrzVmEdS9pxtSB/j6R+NtKIQ05GEJ GdCPv2UUhGKPNEe9PU2kNyMkhtFmbF6BXikTi4Fl2aNCf//GsFpN5K7IPKKlxrA9Exo MZaAmSWmfUTMqsL2GxxIE66heQ2sq5yT4cVO+9OksZAHQQm4Ne0C3/FksIGzXFr62Wv q8tpfMJlwNKY0Fjpqrcl2/42qqQ2hHgp/2W52IVzR7JpZZwcLV7TMHVj2hAzeLvyF0I PIazuiQ0VQ== Original-Received: by smtp.mailfence.com with ESMTPA ; Fri, 30 Oct 2020 23:35:23 +0100 (CET) Original-Received: by breton.holly.idiocy.org (Postfix, from userid 501) id 62A0D20264A29B; Fri, 30 Oct 2020 22:35:21 +0000 (GMT) Mail-Followup-To: Alan Third , Eli Zaretskii , Aaron Jensen , 44313@debbugs.gnu.org Content-Disposition: inline In-Reply-To: <83a6w3a2xc.fsf@gnu.org> X-ContactOffice-Account: com:241649512 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:192215 Archived-At: On Fri, Oct 30, 2020 at 10:12:31PM +0200, Eli Zaretskii wrote: > > From: Aaron Jensen > > Date: Fri, 30 Oct 2020 14:37:04 -0500 > > Cc: 44313@debbugs.gnu.org > > > > On Fri, Oct 30, 2020 at 2:08 PM Eli Zaretskii wrote: > > > I don't know. The code in Fmouse_pixel_position uses the > > > selected-frame, so it is quite strange, to say the least, that this > > > frame could be garbled when you just move the mouse pointer. > > > > I'm in the debugger right now. It happened as soon as I started a > > full-screen zoom screenshare (maybe that's a hint?) > > > > The value of f is different than selected_frame and > > dpyinfo->ns_focus_frame, which means that it's likely set in this > > code: > > > > #ifdef NS_IMPL_COCOA > > /* Find the uppermost Emacs frame under the mouse pointer. > > > > This doesn't work on GNUstep, although in recent versions there > > is compatibility code that makes it a noop. */ > > > > NSPoint screen_position = [NSEvent mouseLocation]; > > NSInteger window_number = 0; > > do > > { > > NSWindow *w; > > > > window_number = [NSWindow windowNumberAtPoint:screen_position > > belowWindowWithWindowNumber:window_number]; > > w = [NSApp windowWithWindowNumber:window_number]; > > > > if (w && [[w delegate] isKindOfClass:[EmacsView class]]) > > f = ((EmacsView *)[w delegate])->emacsframe; > > } > > while (window_number > 0 && !f); > > #endif > > I'll let Alan chime in here. This is deep in NS specific code which > I'm not familiar with. Hmm, this just steps through the OS windows, from top to bottom and finds the first one that is of type EmacsView, which should always be associated with an Emacs frame. The implication here is that we've got an Emacs frame still being displayed after the frame has been freed. That seems a little odd. Maybe we need to ensure that OS windows are closed. Something like this, perhaps: modified src/nsterm.m @@ -1782,6 +1782,8 @@ Hide the window (X11 semantics) { NSTRACE ("ns_destroy_window"); + check_window_system (f); + /* If this frame has a parent window, detach it as not doing so can cause a crash in GNUStep. */ if (FRAME_PARENT_FRAME (f) != NULL) @@ -1792,7 +1794,7 @@ Hide the window (X11 semantics) [parent removeChildWindow: child]; } - check_window_system (f); + [[FRAME_NS_VIEW (f) window] close]; ns_free_frame_resources (f); ns_window_num--; } -- Alan Third