From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Cecilio Pardo Newsgroups: gmane.emacs.bugs Subject: bug#74312: 31.0.50; Cygw32 build break Date: Thu, 14 Nov 2024 09:55:56 +0100 Message-ID: References: <858qtpkemi.wl--xmue@d1.dion.ne.jp> <86serxkb3x.fsf@gnu.org> <0f292392-7a84-4427-a9ed-9a4dc4014a85@cornell.edu> <86wmh9il65.fsf@gnu.org> <4add61f6-3654-4b9f-913b-ec3a52981aea@cornell.edu> <86jzd8ipxj.fsf@gnu.org> <85y11o1la9.wl--xmue@d1.dion.ne.jp> <86bjykiem2.fsf@gnu.org> <85o72jiels.wl--xmue@d1.dion.ne.jp> <2564f4d1-b58a-4b80-9b6e-acc2e8d2c254@imayhem.com> <85msi3jfh6.wl--xmue@d1.dion.ne.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6638"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: Kazuhiro Ito , 74312@debbugs.gnu.org, Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 14 09:57:29 2024 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 1tBVfN-0001Sn-7S for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 14 Nov 2024 09:57:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBVez-0003bW-F2; Thu, 14 Nov 2024 03:57:05 -0500 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 ) id 1tBVew-0003b7-Ph for bug-gnu-emacs@gnu.org; Thu, 14 Nov 2024 03:57:02 -0500 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 ) id 1tBVew-0003P5-Gn for bug-gnu-emacs@gnu.org; Thu, 14 Nov 2024 03:57:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:From:References:MIME-Version:Date:To:Subject; bh=vZpkSLTpdggnVIEHEaWT4gFIrLtBOPJOfBUY86oJhfw=; b=ki436pzo+n83XDIumXme7EkUbjvGeO0xEotS8ThsPYzP0c4UDtHmoOSYTAVdAKv1pnSXyXSrQcharIIU8A0qibGMMr5s0FyWDA6UWNbq9zfbsphNGmouPxiZPi4rpPMrdxxvSRiE6vSQ6sd0d06B1NLvsjKrr5daLDYTjEBPgNOxDrJakqWWgulnOSEacnCBF6uwfXpvqcBVEbuhRKq7oQHGKl8NKKfG6FP4a0FoUdOOwryp/KY2qQDpDj4PlMTzK5zYj1u+qxD/x9qLRR3ut+gO3maD2jNlrmADsM3veyWDqYmWPMXyMEtTe8THtzztsWNv98hjzSCucUkqGSqaPw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tBVew-0002Ld-BU for bug-gnu-emacs@gnu.org; Thu, 14 Nov 2024 03:57:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Cecilio Pardo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 Nov 2024 08:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74312 X-GNU-PR-Package: emacs Original-Received: via spool by 74312-submit@debbugs.gnu.org id=B74312.17315745658909 (code B ref 74312); Thu, 14 Nov 2024 08:57:02 +0000 Original-Received: (at 74312) by debbugs.gnu.org; 14 Nov 2024 08:56:05 +0000 Original-Received: from localhost ([127.0.0.1]:44970 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tBVe0-0002Jc-VY for submit@debbugs.gnu.org; Thu, 14 Nov 2024 03:56:05 -0500 Original-Received: from mail.imayhem.com ([82.223.54.191]:58971 helo=zealous-pike.82-223-54-191.plesk.page) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tBVdz-0002J9-PS for 74312@debbugs.gnu.org; Thu, 14 Nov 2024 03:56:04 -0500 Original-Received: from [192.168.68.104] (111.red-88-21-7.staticip.rima-tde.net [88.21.7.111]) by zealous-pike.82-223-54-191.plesk.page (Postfix) with ESMTPSA id 1013C800CB; Thu, 14 Nov 2024 08:55:58 +0000 (UTC) Authentication-Results: zealous-pike.82-223-54-191.plesk.page; spf=pass (sender IP is 88.21.7.111) smtp.mailfrom=cpardo@imayhem.com smtp.helo=[192.168.68.104] Received-SPF: pass (zealous-pike.82-223-54-191.plesk.page: connection is authenticated) Content-Language: es-ES In-Reply-To: <85msi3jfh6.wl--xmue@d1.dion.ne.jp> 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:295318 Archived-At: On 13/11/2024 16:55, Kazuhiro Ito wrote: >>> Both Emacsen may fail to handle dropped files if I do drag-n-drop >>> files very quickly. I confirmed Microsoft Photo application on >>> Windows 11. And, once Emacs failed to handle drop event, it keeps >>> ignoring dropping files or text event. >> >> I will look into this. > > As far as I tested, drag-n-drop from Microsoft Photo worked only the > first time. Second operation was ignored. Quick operation may fail > even at the first time. Drag-n-drop from explorer worked expectedly. This should fix the Photo application problem. I didn't expect ref counting to be needed for this, my bad. diff --git a/src/w32fns.c b/src/w32fns.c index 1bd3d5099e2..e2455b9271e 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -2562,6 +2562,7 @@ w32_process_dnd_data (int format, void *hGlobal) /* i_drop_target must be the first member. */ IDropTarget i_drop_target; HWND hwnd; + int ref_count; }; static HRESULT STDMETHODCALLTYPE @@ -2573,13 +2574,16 @@ w32_drop_target_QueryInterface (IDropTarget *t, REFIID ri, void **r) static ULONG STDMETHODCALLTYPE w32_drop_target_AddRef (IDropTarget *This) { - return 1; + struct w32_drop_target *target = (struct w32_drop_target *) This; + return ++target->ref_count; } static ULONG STDMETHODCALLTYPE w32_drop_target_Release (IDropTarget *This) { struct w32_drop_target *target = (struct w32_drop_target *) This; + if (--target->ref_count > 0) + return target->ref_count; free (target->i_drop_target.lpVtbl); free (target); return 0; @@ -2770,6 +2774,7 @@ w32_createwindow (struct frame *f, int *coords) if (vtbl != NULL) { drop_target->hwnd = hwnd; + drop_target->ref_count = 0; drop_target->i_drop_target.lpVtbl = vtbl; vtbl->QueryInterface = w32_drop_target_QueryInterface; vtbl->AddRef = w32_drop_target_AddRef;