From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Eli Zaretskii <eliz@gnu.org>
Newsgroups: gmane.emacs.bugs
Subject: bug#69083: Emacs's keyboard hook state is not reset on session lock
 (Windows)
Date: Thu, 14 Mar 2024 10:25:07 +0200
Message-ID: <86il1pb4po.fsf@gnu.org>
References: <yplmeddhpj9t.fsf@mnet-mail.de> <86cyt1qvmt.fsf@gnu.org>
 <yplm34tupxua.fsf@mnet-mail.de> <861q9exmhe.fsf@gnu.org>
 <yplmbk8brl20.fsf@mnet-mail.de> <86v86im1r9.fsf@gnu.org>
 <yplmh6hv9bo0.fsf@mnet-mail.de> <868r36uzdh.fsf@gnu.org>
 <yplmy1b3nhqi.fsf@mnet-mail.de> <86bk7ysbbz.fsf@gnu.org>
 <yplmcysbz2nn.fsf@mnet-mail.de> <868r2znsau.fsf@gnu.org>
 <yplmedcp7tra.fsf@mnet-mail.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="1824"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: 69083-done@debbugs.gnu.org
To: Raffael Stocker <r.stocker@mnet-mail.de>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 14 09:25:59 2024
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
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 <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1rkgPX-0000GD-Ao
	for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 14 Mar 2024 09:25:59 +0100
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces@gnu.org>)
	id 1rkgP3-00075Y-8t; Thu, 14 Mar 2024 04:25:29 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1rkgP1-00075H-Gq
 for bug-gnu-emacs@gnu.org; Thu, 14 Mar 2024 04:25:27 -0400
Original-Received: from debbugs.gnu.org ([2001:470:142:5::43])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1rkgP1-0005dv-8C
 for bug-gnu-emacs@gnu.org; Thu, 14 Mar 2024 04:25:27 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1rkgPa-00083i-Ft
 for bug-gnu-emacs@gnu.org; Thu, 14 Mar 2024 04:26:02 -0400
Resent-From: Eli Zaretskii <eliz@gnu.org>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-To: bug-gnu-emacs@gnu.org
Resent-Date: Thu, 14 Mar 2024 08:26:02 +0000
Resent-Message-ID: <handler.69083.D69083.171040475830958.done@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: cc-closed 69083
X-GNU-PR-Package: emacs
Mail-Followup-To: 69083@debbugs.gnu.org, eliz@gnu.org, r.stocker@mnet-mail.de
Original-Received: via spool by 69083-done@debbugs.gnu.org id=D69083.171040475830958
 (code D ref 69083); Thu, 14 Mar 2024 08:26:02 +0000
Original-Received: (at 69083-done) by debbugs.gnu.org; 14 Mar 2024 08:25:58 +0000
Original-Received: from localhost ([127.0.0.1]:48239 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1rkgPV-00083G-QM
 for submit@debbugs.gnu.org; Thu, 14 Mar 2024 04:25:58 -0400
Original-Received: from eggs.gnu.org ([209.51.188.92]:33826)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@gnu.org>) id 1rkgPT-000833-Pf
 for 69083-done@debbugs.gnu.org; Thu, 14 Mar 2024 04:25:56 -0400
Original-Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@gnu.org>)
 id 1rkgOm-0005cp-RO; Thu, 14 Mar 2024 04:25:14 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=63QbSdz9Y7yfWH8aoyJKCxw2bu00Z+nrxs+0M4tTJkM=; b=nISOHu7GKezIMXDjfuM7
 rf5vB/s+CMpU3hUBC8WNPfeV4OhVN0d8iz3o8xFmmTWyJ9vDf8MDcaC0E4/4rxTG27dHmIN/jjdFM
 8e9SgVbQ0eiawaywucWkxHo0C+1VlpPokvpcclvQIjElUaHOy/hWAKLB5g8zGbDZ6zfsCfL6K9/C3
 DQZqMpLlSfJmZtHx0hAEGXhCgrJnMB/co+i0f5KxvOw2WOK6uGPuzpbfh8AjDCX2+0lyMuHYAn24V
 Mo22kgYWbTEsoXgIL/OwGVztS1Vyd8UpNo5jznYubD/KOhYLcX4cG8lMlM9jGw7ENZwhElCdpw8hT
 klvvT4p5tG3HMQ==;
In-Reply-To: <yplmedcp7tra.fsf@mnet-mail.de> (message from Raffael Stocker on
 Mon, 04 Mar 2024 19:10:33 +0100)
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" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.emacs.bugs:281592
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/281592>

> From: Raffael Stocker <r.stocker@mnet-mail.de>
> Cc: 69083@debbugs.gnu.org
> Date: Mon, 04 Mar 2024 19:10:33 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> The order is not important, I just didn't know where to look to get
> >> a frame; sorry for the noise.  I now use ‘Fnext_frame’.
> >
> > Unfortunately, I don't think you cannot use Fnext_frame here.  The
> > function which calls it, w32_wnd_proc, runs in a separate thread, so
> > it generally cannot access Lisp objects safely.  However, it is okay
> > to traverse the list of the frames, as w32_window_to_frame does, see
> > the comment at the beginning of w32_wnd_proc.  So I think you could
> > use a similar loop with FOR_EACH_FRAME, and use some frame from there,
> > perhaps the first one?
> >
> > Alternatively, and maybe more safely, you could call
> > maybe_pass_notification from w32_destroy_window, which is called from
> > the main (a.k.a. "Lisp") thread, so then you can use Fnext_frame
> > (actually, I would make next_frame extern instead of static and call
> > it directly).  This means the notifications are passed a bit before
> > the frame is actually deleted by the OS, but I think this is okay?
> 
> I went with the first option, using FOR_EACH_FRAME, because I am not
> sure about the safety of modifying the kbdhook struct from the other
> thread.

Thanks.  I needed to fix this in small ways, to get it to compile with
mingw.org's MinGW, and I've now installed the results on the master
branch.

With that, I'm closing this bug.