GNU bug report logs - #65193
29.1.50; SET_FRAME_ICONIFIED can cause Lisp evaluation inside read_socket_hook.

Previous Next

Package: emacs;

Reported by: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>

Date: Thu, 10 Aug 2023 07:42:01 UTC

Severity: normal

Found in version 29.1.50

Full log


Message #26 received at 65193 <at> debbugs.gnu.org (full text, mbox):

From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: luangruo <at> yahoo.com, 65193 <at> debbugs.gnu.org
Subject: Re: bug#65193: 29.1.50;
 SET_FRAME_ICONIFIED can cause Lisp evaluation inside read_socket_hook.
Date: Fri, 11 Aug 2023 08:29:30 +0900
On Fri, 11 Aug 2023 02:58:50 +0900,
Eli Zaretskii wrote:
> 
> > Cc: 65193 <at> debbugs.gnu.org
> > Date: Fri, 11 Aug 2023 01:33:41 +0900
> > From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
> > 
> > Another problem specific to the NS port w.r.t. the call to
> > gui_consider_frame_title from SET_FRAME_ICONIFIED is that it can
> > also be called inside the select emulation via -[EmacsView
> > windowDidDeminiaturize:] for example.
> 
> Please describe in more detail how such a call could happen, including
> the sequence of calls which could call SET_FRAME_ICONIFIED from the
> select emulation.  This situation, if it can happen, should be
> investigated.

Sorry, I thought the NS port can run another Lisp thread while one
thread is waiting for inputs with (emulated) select as in other
platforms (including the Mac port).  But actually that's not the case,
so the situation I said does not happen with the current NS select
emulation.  Of course, once the NS port obtains such ability, the
problem I described will happen.

Below is the stacktrace that leads to SET_FRAME_ICONIFIED from the NS
select emulation (ns_select):

* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 2.1
  * frame #0: 0x0000000100f06f40 Emacs`SET_FRAME_ICONIFIED(f=0x0000000123904aa0, i=0) at frame.h:1300:3
    frame #1: 0x0000000100f3eae0 Emacs`-[EmacsView windowDidDeminiaturize:](self=0x0000000107891800, _cmd="windowDidDeminiaturize:", sender=@"NSWindowDidDeminiaturizeNotification") at nsterm.m:8140:3
    frame #2: 0x000000018d8b25c4 CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 28
    frame #3: 0x000000018d9545a0 CoreFoundation`___CFXRegistrationPost_block_invoke + 52
    frame #4: 0x000000018d95450c CoreFoundation`_CFXRegistrationPost + 456
    frame #5: 0x000000018d88107c CoreFoundation`_CFXNotificationPost + 720
    frame #6: 0x000000018e60e370 Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 64
    frame #7: 0x000000019045724c AppKit`-[NSWindow(NSWindow_Theme) showDeminiaturizedWindow] + 164
    frame #8: 0x000000019096aecc AppKit`___NSWindowAddDockMessageHandlers_block_invoke_3 + 256
    frame #9: 0x000000019023879c AppKit`_NSCGSDockMessageReceive + 1616
    frame #10: 0x00000001958104f0 HIToolbox`DockCallback(unsigned int, unsigned int, void*, void*) + 1532
    frame #11: 0x0000000192af7484 HIServices`_DCXMaximizedWindows + 56
    frame #12: 0x0000000192af7444 HIServices`_XMaximizedWindows + 128
    frame #13: 0x0000000192ae8354 HIServices`mshMIGPerform + 200
    frame #14: 0x000000018d8be5e8 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 60
    frame #15: 0x000000018d8be4a4 CoreFoundation`__CFRunLoopDoSource1 + 596
    frame #16: 0x000000018d8bc924 CoreFoundation`__CFRunLoopRun + 2372
    frame #17: 0x000000018d8bb868 CoreFoundation`CFRunLoopRunSpecific + 600
    frame #18: 0x00000001957e8b40 HIToolbox`RunCurrentEventLoopInMode + 292
    frame #19: 0x00000001957e88b4 HIToolbox`ReceiveNextEventCommon + 552
    frame #20: 0x00000001957e8674 HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 72
    frame #21: 0x00000001900b2028 AppKit`_DPSNextEvent + 836
    frame #22: 0x00000001900b09c8 AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1292
    frame #23: 0x00000001900a2814 AppKit`-[NSApplication run] + 596
    frame #24: 0x0000000100f17fd8 Emacs`-[EmacsApp run](self=0x0000000107700040, _cmd="run") at nsterm.m:5823:7
    frame #25: 0x0000000100f115ac Emacs`ns_select_1(nfds=0, readfds=0x000000016fdf24e0, writefds=0x000000016fdf2580, exceptfds=0x0000000000000000, timeout=0x000000016fdf2650, sigmask=0x0000000000000000, run_loop_only=NO) at nsterm.m:4838:3
    frame #26: 0x0000000100f10e74 Emacs`ns_select(nfds=0, readfds=0x000000016fdf24e0, writefds=0x000000016fdf2580, exceptfds=0x0000000000000000, timeout=0x000000016fdf2650, sigmask=0x0000000000000000) at nsterm.m:4890:10
    frame #27: 0x0000000100d029ac Emacs`wait_reading_process_output(time_limit=30, nsecs=0, read_kbd=-1, do_display=true, wait_for_cell=(i = 0x0000000000000000), wait_proc=0x0000000000000000, just_wait_proc=0) at process.c:5689:18
    frame #28: 0x0000000100027654 Emacs`sit_for(timeout=(i = 0x000000000000007a), reading=true, display_option=1) at dispnew.c:6264:7
    frame #29: 0x00000001006327b4 Emacs`read_char(commandflag=1, map=(i = 0x0000000106fdd243), prev_event=(i = 0x0000000000000000), used_mouse_menu=0x000000016fdf8ae0, end_time=0x0000000000000000) at keyboard.c:2881:11
    frame #30: 0x00000001006214ac Emacs`read_key_sequence(keybuf=0x000000016fdfb580, prompt=(i = 0x0000000000000000), dont_downcase_last=false, can_return_switch_frame=true, fix_current_buffer=true, prevent_redisplay=false) at keyboard.c:10083:12
    frame #31: 0x00000001006195fc Emacs`command_loop_1 at keyboard.c:1384:15
    frame #32: 0x0000000100aa1a50 Emacs`internal_condition_case(bfun=(Emacs`command_loop_1 at keyboard.c:1278), handlers=(i = 0x0000000000000090), hfun=(Emacs`cmd_error at keyboard.c:936)) at eval.c:1474:25
    frame #33: 0x000000010061789c Emacs`command_loop_2(handlers=(i = 0x0000000000000090)) at keyboard.c:1133:11
    frame #34: 0x0000000100a9e27c Emacs`internal_catch(tag=(i = 0x000000000000eac0), func=(Emacs`command_loop_2 at keyboard.c:1129), arg=(i = 0x0000000000000090)) at eval.c:1197:25
    frame #35: 0x0000000100612cdc Emacs`command_loop at keyboard.c:1111:2
    frame #36: 0x0000000100612060 Emacs`recursive_edit_1 at keyboard.c:720:9
    frame #37: 0x0000000100613f74 Emacs`Frecursive_edit at keyboard.c:803:3
    frame #38: 0x0000000100605848 Emacs`main(argc=2, argv=0x000000016fdff6a8) at emacs.c:2521:3
    frame #39: 0x000000018d7dd430 libdyld.dylib`start + 4

				     YAMAMOTO Mitsuharu
				mituharu <at> math.s.chiba-u.ac.jp




This bug report was last modified 1 year and 311 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.