From unknown Sat Jun 21 03:30:02 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32812: 27.0.50; macOS Mojave GNU Emacs crash after 5-10 minutes or so Resent-From: "Zack Piper" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 23 Sep 2018 17:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 32812 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 32812@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.153772255927111 (code B ref -1); Sun, 23 Sep 2018 17:10:02 +0000 Received: (at submit) by debbugs.gnu.org; 23 Sep 2018 17:09:19 +0000 Received: from localhost ([127.0.0.1]:51036 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g47sj-00073B-2I for submit@debbugs.gnu.org; Sun, 23 Sep 2018 13:09:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56904) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g46Nc-0004mU-7B for submit@debbugs.gnu.org; Sun, 23 Sep 2018 11:33:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g46NO-0006DB-1w for submit@debbugs.gnu.org; Sun, 23 Sep 2018 11:32:57 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,HTML_MESSAGE, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:59440) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g46NH-00068t-5m for submit@debbugs.gnu.org; Sun, 23 Sep 2018 11:32:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38162) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g46NA-0000aw-Fr for bug-gnu-emacs@gnu.org; Sun, 23 Sep 2018 11:32:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g46N1-0005yB-43 for bug-gnu-emacs@gnu.org; Sun, 23 Sep 2018 11:32:34 -0400 Received: from 183.ip-51-68-126.eu ([51.68.126.183]:52000 helo=zmail.apertron.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g46LU-0004qE-7u for bug-gnu-emacs@gnu.org; Sun, 23 Sep 2018 11:32:22 -0400 Received: from [10.37.129.2] (host-92-11-100-92.as43234.net [92.11.100.92]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: zack@apertron.com) by zmail.apertron.com (Postfix) with ESMTPSA id 5428A60A04 for ; Sun, 23 Sep 2018 15:21:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apertron.com; s=dkim; t=1537716070; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references; bh=waEk0x2EDZdJfVTv2onUtW5stBiFEhrF9Xag8txhdyA=; b=LDBzCT5Yc7ipra1eqi+ThcBK57zyhlDk5cEDkzNn3+aVSt+A66EYaTkz5XcI+eg/5AgLxR au52tgkbw7mL4Xki7+YqI89U+AbNH9ZKStUrtBdQW6uHk5pmQMo/blvfJHnvJoRscCdUfd 0aqEjO5K64/UUj+AtmiQm6r7T49kkqc= From: "Zack Piper" Date: Sun, 23 Sep 2018 16:21:13 +0100 Message-ID: <8C435A35-6F98-45D4-AF3E-1052E9420212@apertron.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_MailMate_15D6F859-CEB5-4223-ACEC-B3386C3809D5_=" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=apertron.com; s=dkim; t=1537716070; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references; bh=waEk0x2EDZdJfVTv2onUtW5stBiFEhrF9Xag8txhdyA=; b=eyv5DGyDjbT3er4q+XZTMMW77zxWTR7oN8Glub9N7aHFZ+Jv4ROZBYtVDVLjunxGw5WMBe Tws+9w9/buS4qHa4r9bcSGjAGg0u4DYF17SYXB+prCkhWY7VSqYwzlzMyqJRkGifxrQqfm Z46qIOW06hJv/V7EgTUoIJqFhFTQUxI= ARC-Seal: i=1; s=dkim; d=apertron.com; t=1537716070; a=rsa-sha256; cv=none; b=N8O1ESpodrEKDHqlpZRIpW7mVJtKs/2uk3XOOFhr+Olysp+2IJjB9ggorXunPumy17JlFXDwC+S1+Cwxl/FiXk/jwbbg9bexLAks3ECHDMEj1xsVNW7amu9Pb9sIR10A1cGTPijUKB6Z54mKkk4BKaAHSSarvf4tV2I4fIuTmAI= ARC-Authentication-Results: i=1; zmail.apertron.com; auth=pass smtp.auth=zack@apertron.com smtp.mailfrom=zack@apertron.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Mailman-Approved-At: Sun, 23 Sep 2018 13:09:16 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --=_MailMate_15D6F859-CEB5-4223-ACEC-B3386C3809D5_= Content-Type: multipart/alternative; boundary="=_MailMate_65DE84D5-2086-498F-86F7-68B534D7F788_=" --=_MailMate_65DE84D5-2086-498F-86F7-68B534D7F788_= Content-Type: text/plain; format=flowed; markup=markdown Content-Transfer-Encoding: quoted-printable Hi! (Replacing my post in #31904 with this since they're separate issues(?)) I've applied a slightly modified (i.e. updated) version of Alan's patch = from bug #31904 (attached) to fix an issue concerning the buffer and mode-line not being = rendered. The patch works great, everything is now rendered. Now I notice that after 5-10 minutes (or even before), Emacs crashes = with the below: ``` objc[82784]: Invalid or prematurely-freed autorelease pool 0x1030032e0. ``` This started occurring since upgrading to macOS Mojave, so possibly = there's a bug with Mojave or just some incompatibility, not really sure! (I'm hoping I got it compiled with the appropriate parameters for = debugging) The crash isn't intermittent, just takes a variable amount of time to = trigger. It can trigger regardless of me using Emacs (i.e. typing) or not. Also worthy to note this happens with the original patch applied to the = emacs-26 branch. Below is a backtrace of the issue: ``` objc[95306]: Invalid or prematurely-freed autorelease pool 0x103e60378. Process 95306 stopped * thread #1, queue =3D 'com.apple.main-thread', stop reason =3D signal = SIGABRT frame #0: 0x00007fff7679b01e = libsystem_kernel.dylib`__abort_with_payload + 10 libsystem_kernel.dylib`__abort_with_payload: -> 0x7fff7679b01e <+10>: jae 0x7fff7679b028 ; <+20> 0x7fff7679b020 <+12>: movq %rax, %rdi 0x7fff7679b023 <+15>: jmp 0x7fff7677de67 ; = cerror_nocancel 0x7fff7679b028 <+20>: retq Target 0: (Emacs) stopped. (lldb) bt all * thread #1, queue =3D 'com.apple.main-thread', stop reason =3D signal = SIGABRT * frame #0: 0x00007fff7679b01e = libsystem_kernel.dylib`__abort_with_payload + 10 frame #1: 0x00007fff76796561 = libsystem_kernel.dylib`abort_with_payload_wrapper_internal + 82 frame #2: 0x00007fff7679650f = libsystem_kernel.dylib`abort_with_reason + 22 frame #3: 0x00007fff75579674 libobjc.A.dylib`_objc_fatalv(unsigned = long long, unsigned long long, char const*, __va_list_tag*) + 108 frame #4: 0x00007fff75579526 libobjc.A.dylib`_objc_fatal(char = const*, ...) + 135 frame #5: 0x00007fff7556bd73 libobjc.A.dylib`(anonymous = namespace)::AutoreleasePoolPage::pop(void*) + 957 frame #6: 0x00007fff46c2d232 AppKit`-[NSView(NSInternal) = _recursive:displayRectIgnoringOpacity:inContext:shouldChangeFontReference= Color:stopAtLayerBackedViews:] = + 3454 frame #7: 0x00007fff46c2c4a2 AppKit`__46-[NSView(NSLayerKitGlue) = drawLayer:inContext:]_block_invoke + 192 frame #8: 0x00007fff46c2c201 AppKit`-[NSView(NSLayerKitGlue) = _drawViewBackingLayer:inContext:drawingHandler:] + 1769 frame #9: 0x00007fff54540aaf QuartzCore`CABackingStoreUpdate_ + 577 frame #10: 0x00007fff545a2325 = QuartzCore`___ZN2CA5Layer8display_Ev_block_invoke + 53 frame #11: 0x00007fff5453fc90 QuartzCore`-[CALayer _display] + 1839 frame #12: 0x00007fff46c2b75a AppKit`_NSBackingLayerDisplay + 531 frame #13: 0x00007fff46c0fcc9 AppKit`-[_NSViewBackingLayer display] = + 811 frame #14: 0x00007fff46c0f949 AppKit`_NSBackingLayerDisplayIfNeeded = + 40 frame #15: 0x00007fff46c0f2a4 AppKit`-[NSView displayIfNeeded] + = 130 frame #16: 0x0000000100026514 Emacs`echo_area_display + 593 frame #17: 0x00000001000261ca Emacs`message3_nolog + 393 frame #18: 0x0000000100025fe3 Emacs`message3 + 399 frame #19: 0x0000000100106a03 Emacs`Fmessage + 67 frame #20: 0x000000010010f525 Emacs`Ffuncall + 665 frame #21: 0x0000000100145e02 Emacs`exec_byte_code + 1486 frame #22: 0x0000000100110040 Emacs`funcall_lambda + 648 frame #23: 0x000000010010f4c2 Emacs`Ffuncall + 566 frame #24: 0x000000010010f704 Emacs`funcall_nil + 9 frame #25: 0x000000010010f6a0 Emacs`run_hook_with_args + 198 frame #26: 0x000000010010f58b Emacs`Frun_hooks + 60 frame #27: 0x000000010010f525 Emacs`Ffuncall + 665 frame #28: 0x0000000100145e02 Emacs`exec_byte_code + 1486 frame #29: 0x000000010010f4c2 Emacs`Ffuncall + 566 frame #30: 0x0000000100145e02 Emacs`exec_byte_code + 1486 frame #31: 0x000000010010f4c2 Emacs`Ffuncall + 566 frame #32: 0x0000000100145e02 Emacs`exec_byte_code + 1486 frame #33: 0x000000010010f4c2 Emacs`Ffuncall + 566 frame #34: 0x0000000100145e02 Emacs`exec_byte_code + 1486 frame #35: 0x000000010010f4c2 Emacs`Ffuncall + 566 frame #36: 0x0000000100145e02 Emacs`exec_byte_code + 1486 frame #37: 0x000000010010f4c2 Emacs`Ffuncall + 566 frame #38: 0x0000000100145e02 Emacs`exec_byte_code + 1486 frame #39: 0x000000010010ee62 Emacs`apply_lambda + 369 frame #40: 0x000000010010c484 Emacs`eval_sub + 845 frame #41: 0x000000010012d294 Emacs`readevalloop + 1773 frame #42: 0x000000010012d502 Emacs`Feval_buffer + 368 frame #43: 0x000000010010fcfe Emacs`funcall_subr + 367 frame #44: 0x000000010010f525 Emacs`Ffuncall + 665 frame #45: 0x0000000100145e02 Emacs`exec_byte_code + 1486 frame #46: 0x0000000100110040 Emacs`funcall_lambda + 648 frame #47: 0x000000010010f4c2 Emacs`Ffuncall + 566 frame #48: 0x000000010010f9d1 Emacs`call4 + 58 frame #49: 0x000000010012b845 Emacs`Fload + 1373 frame #50: 0x000000010010fcfe Emacs`funcall_subr + 367 frame #51: 0x000000010010f525 Emacs`Ffuncall + 665 frame #52: 0x0000000100145e02 Emacs`exec_byte_code + 1486 frame #53: 0x000000010010f4c2 Emacs`Ffuncall + 566 frame #54: 0x0000000100145e02 Emacs`exec_byte_code + 1486 frame #55: 0x000000010010f4c2 Emacs`Ffuncall + 566 frame #56: 0x0000000100145e02 Emacs`exec_byte_code + 1486 frame #57: 0x000000010010ee62 Emacs`apply_lambda + 369 frame #58: 0x000000010010c484 Emacs`eval_sub + 845 frame #59: 0x000000010010ec69 Emacs`Feval + 96 frame #60: 0x000000010010dffd Emacs`internal_condition_case + 87 frame #61: 0x00000001000b17be Emacs`top_level_1 + 45 frame #62: 0x000000010010db85 Emacs`internal_catch + 74 frame #63: 0x00000001000a4a90 Emacs`command_loop + 141 frame #64: 0x00000001000a49c1 Emacs`recursive_edit_1 + 115 frame #65: 0x00000001000a4bdd Emacs`Frecursive_edit + 226 frame #66: 0x00000001000a3aa9 Emacs`main + 5211 frame #67: 0x00007fff76645085 libdyld.dylib`start + 1 frame #68: 0x00007fff76645085 libdyld.dylib`start + 1 thread #2 frame #0: 0x00007fff7677f5be = libsystem_kernel.dylib`__workq_kernreturn + 10 frame #1: 0x6874656d00000000 frame #2: 0x00007fff76836415 libsystem_pthread.dylib`start_wqthread = + 13 thread #3 frame #0: 0x00007fff7677f5be = libsystem_kernel.dylib`__workq_kernreturn + 10 frame #1: 0x00007fff76836641 = libsystem_pthread.dylib`_pthread_wqthread + 446 frame #2: 0x00007fff76836415 libsystem_pthread.dylib`start_wqthread = + 13 thread #4, name =3D 'gmain' frame #0: 0x00007fff76784e82 libsystem_kernel.dylib`__select + 10 frame #1: 0x0000000100a083da libglib-2.0.0.dylib`g_poll + 405 frame #2: 0x00000001009fc123 = libglib-2.0.0.dylib`g_main_context_iterate + 340 frame #3: 0x00000001009fc1d1 = libglib-2.0.0.dylib`g_main_context_iteration + 55 frame #4: 0x00000001009fd2b0 libglib-2.0.0.dylib`glib_worker_main + = 30 frame #5: 0x0000000100a1dcb7 libglib-2.0.0.dylib`g_thread_proxy + = 90 frame #6: 0x00007fff7683733d libsystem_pthread.dylib`_pthread_body = + 126 frame #7: 0x00007fff7683a2a7 libsystem_pthread.dylib`_pthread_start = + 70 frame #8: 0x00007fff76836425 libsystem_pthread.dylib`thread_start + = 13 thread #5 frame #0: 0x00007fff7677f5be = libsystem_kernel.dylib`__workq_kernreturn + 10 frame #1: 0x00007fff76836721 = libsystem_pthread.dylib`_pthread_wqthread + 670 frame #2: 0x00007fff76836415 libsystem_pthread.dylib`start_wqthread = + 13 thread #7 frame #0: 0x00007fff76784e82 libsystem_kernel.dylib`__select + 10 frame #1: 0x000000010017c408 Emacs`-[EmacsApp fd_handler:] + 214 frame #2: 0x00007fff4b902234 Foundation`__NSThread__start__ + 1218 frame #3: 0x00007fff7683733d libsystem_pthread.dylib`_pthread_body = + 126 frame #4: 0x00007fff7683a2a7 libsystem_pthread.dylib`_pthread_start = + 70 frame #5: 0x00007fff76836425 libsystem_pthread.dylib`thread_start + = 13 thread #9, name =3D 'com.apple.NSEventThread' frame #0: 0x00007fff7677dc2a libsystem_kernel.dylib`mach_msg_trap + = 10 frame #1: 0x00007fff7677e174 libsystem_kernel.dylib`mach_msg + 60 frame #2: 0x00007fff495ad05e = CoreFoundation`__CFRunLoopServiceMachPort + 337 frame #3: 0x00007fff495ac5ad CoreFoundation`__CFRunLoopRun + 1654 frame #4: 0x00007fff495abce4 CoreFoundation`CFRunLoopRunSpecific + = 463 frame #5: 0x00007fff46b0b581 AppKit`_NSEventThread + 160 frame #6: 0x00007fff7683733d libsystem_pthread.dylib`_pthread_body = + 126 frame #7: 0x00007fff7683a2a7 libsystem_pthread.dylib`_pthread_start = + 70 frame #8: 0x00007fff76836425 libsystem_pthread.dylib`thread_start + = 13 (lldb) ``` In GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin18.0.0, NS = appkit-1671.00 Version 10.14 (Build 18A389)) of 2018-09-19 built on zoral Repository revision: 75d9a55fae1c484aa6d213064931bfe3b65cf5dd Windowing system distributor 'Apple', version 10.3.1671 System Description: Mac OS X 10.14 Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Configured using: 'configure --disable-dependency-tracking --disable-silent-rules --enable-locallisppath=3D/usr/local/share/emacs/site-lisp --enable-check-lisp-object-type --infodir=3D/usr/local/Cellar/emacs-plus/HEAD-75d9a55/share/info/emacs --prefix=3D/usr/local/Cellar/emacs-plus/HEAD-75d9a55 --with-xml2 --without-dbus --with-gnutls --with-imagemagick --with-modules --with-rsvg --with-ns --disable-ns-self-contained 'CFLAGS=3D-O0 -g3'' Configured features: RSVG IMAGEMAGICK GLIB NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS LCMS2 GMP Important settings: value of $LANG: en_GB.UTF-8 locale-coding-system: utf-8-unix Major mode: Fundamental Minor modes in effect: tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair time-date tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads kqueue cocoa ns lcms2 multi-tty make-network-process emacs) Memory information: ((conses 16 204840 9831) (symbols 48 20275 1) (strings 32 29150 2191) (string-bytes 1 776518) (vectors 16 35468) (vector-slots 8 735114 19448) (floats 8 46 70) (intervals 56 229 0) (buffers 992 12)) --=_MailMate_65DE84D5-2086-498F-86F7-68B534D7F788_= Content-Type: text/html Content-Transfer-Encoding: quoted-printable

Hi!

(Replacing my post in #31904 with this since they're sepa= rate issues(?))

I've applied a slightly modified (i.e. updated) version o= f Alan's patch from bug #31904
(attached) to fix an issue concerning the buffer and mode-line not being = rendered. The patch works great, everything is now rendered.

Now I notice that after 5-10 minutes (or even before), Em= acs crashes with the below:

objc[82784]: Inva=
lid or prematurely-freed autorelease pool 0x1030032e0.

This started occurring since upgrading to macOS Mojave, s= o possibly there's a bug with Mojave or just some incompatibility, not re= ally sure!

(I'm hoping I got it compiled with the appropriate parame= ters for debugging)

The crash isn't intermittent, just takes a variable amoun= t of time to trigger. It
can trigger regardless of me using Emacs (i.e. typing) or not.

Also worthy to note this happens with the original patch = applied to the emacs-26 branch.

Below is a backtrace of the issue:

objc[95306]: Inva=
lid or prematurely-freed autorelease pool 0x103e60378.
Process 95306 stopped
* thread #1, queue =3D 'com.apple.main-thread', stop reason =3D signal SI=
GABRT
    frame #0: 0x00007fff7679b01e libsystem_kernel.dylib`__abort_with_payl=
oad + 10
libsystem_kernel.dylib`__abort_with_payload:
->  0x7fff7679b01e <+10>: jae    0x7fff7679b028            ; <=
;+20>
    0x7fff7679b020 <+12>: movq   %rax, %rdi
    0x7fff7679b023 <+15>: jmp    0x7fff7677de67            ; cerror=
_nocancel
    0x7fff7679b028 <+20>: retq
Target 0: (Emacs) stopped.
(lldb) bt all
* thread #1, queue =3D 'com.apple.main-thread', stop reason =3D signal SI=
GABRT
  * frame #0: 0x00007fff7679b01e libsystem_kernel.dylib`__abort_with_payl=
oad + 10
    frame #1: 0x00007fff76796561 libsystem_kernel.dylib`abort_with_payloa=
d_wrapper_internal + 82
    frame #2: 0x00007fff7679650f libsystem_kernel.dylib`abort_with_reason=
 + 22
    frame #3: 0x00007fff75579674 libobjc.A.dylib`_objc_fatalv(unsigned lo=
ng long, unsigned long long, char const*, __va_list_tag*) + 108
    frame #4: 0x00007fff75579526 libobjc.A.dylib`_objc_fatal(char const*,=
 ...) + 135
    frame #5: 0x00007fff7556bd73 libobjc.A.dylib`(anonymous namespace)::A=
utoreleasePoolPage::pop(void*) + 957
    frame #6: 0x00007fff46c2d232 AppKit`-[NSView(NSInternal) _recursive:d=
isplayRectIgnoringOpacity:inContext:shouldChangeFontReferenceColor:stopAt=
LayerBackedViews:] + 3454
    frame #7: 0x00007fff46c2c4a2 AppKit`__46-[NSView(NSLayerKitGlue) draw=
Layer:inContext:]_block_invoke + 192
    frame #8: 0x00007fff46c2c201 AppKit`-[NSView(NSLayerKitGlue) _drawVie=
wBackingLayer:inContext:drawingHandler:] + 1769
    frame #9: 0x00007fff54540aaf QuartzCore`CABackingStoreUpdate_ + 577
    frame #10: 0x00007fff545a2325 QuartzCore`___ZN2CA5Layer8display_Ev_bl=
ock_invoke + 53
    frame #11: 0x00007fff5453fc90 QuartzCore`-[CALayer _display] + 1839
    frame #12: 0x00007fff46c2b75a AppKit`_NSBackingLayerDisplay + 531
    frame #13: 0x00007fff46c0fcc9 AppKit`-[_NSViewBackingLayer display] +=
 811
    frame #14: 0x00007fff46c0f949 AppKit`_NSBackingLayerDisplayIfNeeded +=
 40
    frame #15: 0x00007fff46c0f2a4 AppKit`-[NSView displayIfNeeded] + 130
    frame #16: 0x0000000100026514 Emacs`echo_area_display + 593
    frame #17: 0x00000001000261ca Emacs`message3_nolog + 393
    frame #18: 0x0000000100025fe3 Emacs`message3 + 399
    frame #19: 0x0000000100106a03 Emacs`Fmessage + 67
    frame #20: 0x000000010010f525 Emacs`Ffuncall + 665
    frame #21: 0x0000000100145e02 Emacs`exec_byte_code + 1486
    frame #22: 0x0000000100110040 Emacs`funcall_lambda + 648
    frame #23: 0x000000010010f4c2 Emacs`Ffuncall + 566
    frame #24: 0x000000010010f704 Emacs`funcall_nil + 9
    frame #25: 0x000000010010f6a0 Emacs`run_hook_with_args + 198
    frame #26: 0x000000010010f58b Emacs`Frun_hooks + 60
    frame #27: 0x000000010010f525 Emacs`Ffuncall + 665
    frame #28: 0x0000000100145e02 Emacs`exec_byte_code + 1486
    frame #29: 0x000000010010f4c2 Emacs`Ffuncall + 566
    frame #30: 0x0000000100145e02 Emacs`exec_byte_code + 1486
    frame #31: 0x000000010010f4c2 Emacs`Ffuncall + 566
    frame #32: 0x0000000100145e02 Emacs`exec_byte_code + 1486
    frame #33: 0x000000010010f4c2 Emacs`Ffuncall + 566
    frame #34: 0x0000000100145e02 Emacs`exec_byte_code + 1486
    frame #35: 0x000000010010f4c2 Emacs`Ffuncall + 566
    frame #36: 0x0000000100145e02 Emacs`exec_byte_code + 1486
    frame #37: 0x000000010010f4c2 Emacs`Ffuncall + 566
    frame #38: 0x0000000100145e02 Emacs`exec_byte_code + 1486
    frame #39: 0x000000010010ee62 Emacs`apply_lambda + 369
    frame #40: 0x000000010010c484 Emacs`eval_sub + 845
    frame #41: 0x000000010012d294 Emacs`readevalloop + 1773
    frame #42: 0x000000010012d502 Emacs`Feval_buffer + 368
    frame #43: 0x000000010010fcfe Emacs`funcall_subr + 367
    frame #44: 0x000000010010f525 Emacs`Ffuncall + 665
    frame #45: 0x0000000100145e02 Emacs`exec_byte_code + 1486
    frame #46: 0x0000000100110040 Emacs`funcall_lambda + 648
    frame #47: 0x000000010010f4c2 Emacs`Ffuncall + 566
    frame #48: 0x000000010010f9d1 Emacs`call4 + 58
    frame #49: 0x000000010012b845 Emacs`Fload + 1373
    frame #50: 0x000000010010fcfe Emacs`funcall_subr + 367
    frame #51: 0x000000010010f525 Emacs`Ffuncall + 665
    frame #52: 0x0000000100145e02 Emacs`exec_byte_code + 1486
    frame #53: 0x000000010010f4c2 Emacs`Ffuncall + 566
    frame #54: 0x0000000100145e02 Emacs`exec_byte_code + 1486
    frame #55: 0x000000010010f4c2 Emacs`Ffuncall + 566
    frame #56: 0x0000000100145e02 Emacs`exec_byte_code + 1486
    frame #57: 0x000000010010ee62 Emacs`apply_lambda + 369
    frame #58: 0x000000010010c484 Emacs`eval_sub + 845
    frame #59: 0x000000010010ec69 Emacs`Feval + 96
    frame #60: 0x000000010010dffd Emacs`internal_condition_case + 87
    frame #61: 0x00000001000b17be Emacs`top_level_1 + 45
    frame #62: 0x000000010010db85 Emacs`internal_catch + 74
    frame #63: 0x00000001000a4a90 Emacs`command_loop + 141
    frame #64: 0x00000001000a49c1 Emacs`recursive_edit_1 + 115
    frame #65: 0x00000001000a4bdd Emacs`Frecursive_edit + 226
    frame #66: 0x00000001000a3aa9 Emacs`main + 5211
    frame #67: 0x00007fff76645085 libdyld.dylib`start + 1
    frame #68: 0x00007fff76645085 libdyld.dylib`start + 1
  thread #2
    frame #0: 0x00007fff7677f5be libsystem_kernel.dylib`__workq_kernretur=
n + 10
    frame #1: 0x6874656d00000000
    frame #2: 0x00007fff76836415 libsystem_pthread.dylib`start_wqthread +=
 13
  thread #3
    frame #0: 0x00007fff7677f5be libsystem_kernel.dylib`__workq_kernretur=
n + 10
    frame #1: 0x00007fff76836641 libsystem_pthread.dylib`_pthread_wqthrea=
d + 446
    frame #2: 0x00007fff76836415 libsystem_pthread.dylib`start_wqthread +=
 13
  thread #4, name =3D 'gmain'
    frame #0: 0x00007fff76784e82 libsystem_kernel.dylib`__select + 10
    frame #1: 0x0000000100a083da libglib-2.0.0.dylib`g_poll + 405
    frame #2: 0x00000001009fc123 libglib-2.0.0.dylib`g_main_context_itera=
te + 340
    frame #3: 0x00000001009fc1d1 libglib-2.0.0.dylib`g_main_context_itera=
tion + 55
    frame #4: 0x00000001009fd2b0 libglib-2.0.0.dylib`glib_worker_main + 3=
0
    frame #5: 0x0000000100a1dcb7 libglib-2.0.0.dylib`g_thread_proxy + 90
    frame #6: 0x00007fff7683733d libsystem_pthread.dylib`_pthread_body + =
126
    frame #7: 0x00007fff7683a2a7 libsystem_pthread.dylib`_pthread_start +=
 70
    frame #8: 0x00007fff76836425 libsystem_pthread.dylib`thread_start + 1=
3
  thread #5
    frame #0: 0x00007fff7677f5be libsystem_kernel.dylib`__workq_kernretur=
n + 10
    frame #1: 0x00007fff76836721 libsystem_pthread.dylib`_pthread_wqthrea=
d + 670
    frame #2: 0x00007fff76836415 libsystem_pthread.dylib`start_wqthread +=
 13
  thread #7
    frame #0: 0x00007fff76784e82 libsystem_kernel.dylib`__select + 10
    frame #1: 0x000000010017c408 Emacs`-[EmacsApp fd_handler:] + 214
    frame #2: 0x00007fff4b902234 Foundation`__NSThread__start__ + 1218
    frame #3: 0x00007fff7683733d libsystem_pthread.dylib`_pthread_body + =
126
    frame #4: 0x00007fff7683a2a7 libsystem_pthread.dylib`_pthread_start +=
 70
    frame #5: 0x00007fff76836425 libsystem_pthread.dylib`thread_start + 1=
3
  thread #9, name =3D 'com.apple.NSEventThread'
    frame #0: 0x00007fff7677dc2a libsystem_kernel.dylib`mach_msg_trap + 1=
0
    frame #1: 0x00007fff7677e174 libsystem_kernel.dylib`mach_msg + 60
    frame #2: 0x00007fff495ad05e CoreFoundation`__CFRunLoopServiceMachPor=
t + 337
    frame #3: 0x00007fff495ac5ad CoreFoundation`__CFRunLoopRun + 1654
    frame #4: 0x00007fff495abce4 CoreFoundation`CFRunLoopRunSpecific + 46=
3
    frame #5: 0x00007fff46b0b581 AppKit`_NSEventThread + 160
    frame #6: 0x00007fff7683733d libsystem_pthread.dylib`_pthread_body + =
126
    frame #7: 0x00007fff7683a2a7 libsystem_pthread.dylib`_pthread_start +=
 70
    frame #8: 0x00007fff76836425 libsystem_pthread.dylib`thread_start + 1=
3
(lldb)

In GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin18.0.0,= NS appkit-1671.00 Version 10.14 (Build 18A389))
of 2018-09-19 built on zoral
Repository revision: 75d9a55fae1c484aa6d213064931bfe3b65cf5dd
Windowing system distributor 'Apple', version 10.3.1671
System Description: Mac OS X 10.14

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
'configure --disable-dependency-tracking --disable-silent-rules
--enable-locallisppath=3D/usr/local/share/emacs/site-lisp
--enable-check-lisp-object-type
--infodir=3D/usr/local/Cellar/emacs-plus/HEAD-75d9a55/share/info/emacs --prefix=3D/usr/local/Cellar/emacs-plus/HEAD-75d9a55 --with-xml2
--without-dbus --with-gnutls --with-imagemagick --with-modules
--with-rsvg --with-ns --disable-ns-self-contained 'CFLAGS=3D-O0 -g3''

Configured features:
RSVG IMAGEMAGICK GLIB NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS<= br> NS MODULES THREADS LCMS2 GMP

Important settings:
value of $LANG: en_GB.UTF-8
locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
buffer-read-only: t
line-number-mode: t
transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config gnus-util
rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
= mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair time-date
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core term/tty-colors frame cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads kqueue cocoa ns<= br> lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 204840 9831)
(symbols 48 20275 1)
(strings 32 29150 2191)
(string-bytes 1 776518)
(vectors 16 35468)
(vector-slots 8 735114 19448)
(floats 8 46 70)
(intervals 56 229 0)
(buffers 992 12))

--=_MailMate_65DE84D5-2086-498F-86F7-68B534D7F788_=-- --=_MailMate_15D6F859-CEB5-4223-ACEC-B3386C3809D5_= Content-Disposition: attachment; filename=0001-nsterm.m.patch Content-Transfer-Encoding: quoted-printable =46rom dea03ff92e307456d103f716652ae76987da02f9 Mon Sep 17 00:00:00 2001 From: Zack Piper Date: Tue, 18 Sep 2018 21:42:55 +0100 Subject: [PATCH] nsterm.m --- src/nsterm.m | 735 +++++++++++++++++++++++++-------------------------- 1 file changed, 364 insertions(+), 371 deletions(-) diff --git a/src/nsterm.m b/src/nsterm.m index 961271f2d0..a2117eb027 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -278,8 +278,6 @@ - (NSColor *)colorUsingDefaultColorSpace long context_menu_value =3D 0; = /* display update */ -static struct frame *ns_updating_frame; -static NSView *focus_view =3D NULL; static int ns_window_num =3D 0; #ifdef NS_IMPL_GNUSTEP static NSRect uRect; // TODO: This is dead, remove it? @@ -1109,30 +1107,29 @@ static NSRect constrain_frame_rect(NSRect frameRe= ct, bool isFullscreen) } #endif = - ns_updating_frame =3D f; - [view lockFocus]; - /* drawRect may have been called for say the minibuffer, and then clip= path is for the minibuffer. But the display engine may draw more becaus= e we have set the frame as garbaged. So reset clip path to the whole= view. */ + /* FIXME: I don't think we need to do this. */ #ifdef NS_IMPL_COCOA - { - NSBezierPath *bp; - NSRect r =3D [view frame]; - NSRect cr =3D [[view window] frame]; - /* If a large frame size is set, r may be larger than the window fra= me - before constrained. In that case don't change the clip path, as = we - will clear in to the tool bar and title bar. */ - if (r.size.height - + FRAME_NS_TITLEBAR_HEIGHT (f) - + FRAME_TOOLBAR_HEIGHT (f) <=3D cr.size.height) - { - bp =3D [[NSBezierPath bezierPathWithRect: r] retain]; - [bp setClip]; - [bp release]; - } - } + if ([NSView focusView] =3D=3D FRAME_NS_VIEW (f)) + { + NSBezierPath *bp; + NSRect r =3D [view frame]; + NSRect cr =3D [[view window] frame]; + /* If a large frame size is set, r may be larger than the window f= rame + before constrained. In that case don't change the clip path, a= s we + will clear in to the tool bar and title bar. */ + if (r.size.height + + FRAME_NS_TITLEBAR_HEIGHT (f) + + FRAME_TOOLBAR_HEIGHT (f) <=3D cr.size.height) + { + bp =3D [[NSBezierPath bezierPathWithRect: r] retain]; + [bp setClip]; + [bp release]; + } + } #endif = #ifdef NS_IMPL_GNUSTEP @@ -1218,23 +1215,14 @@ static NSRect constrain_frame_rect(NSRect frameRe= ct, bool isFullscreen) external (RIF) call; for whole frame, called after update_window_end ---------------------------------------------------------------------= ----- */ { - EmacsView *view =3D FRAME_NS_VIEW (f); - NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_update_end"); = /* if (f =3D=3D MOUSE_HL_INFO (f)->mouse_face_mouse_frame) */ MOUSE_HL_INFO (f)->mouse_face_defer =3D 0; - - block_input (); - - [view unlockFocus]; - [[view window] flushWindow]; - - unblock_input (); - ns_updating_frame =3D NULL; } = -static void + +static BOOL ns_focus (struct frame *f, NSRect *r, int n) /* ---------------------------------------------------------------------= ----- Internal: Focus on given frame. During small local updates this is u= sed to @@ -1246,48 +1234,38 @@ static NSRect constrain_frame_rect(NSRect frameRe= ct, bool isFullscreen) ---------------------------------------------------------------------= ----- */ { NSTRACE_WHEN (NSTRACE_GROUP_FOCUS, "ns_focus"); - if (r !=3D NULL) + if (r) { NSTRACE_RECT ("r", *r); - } = - if (f !=3D ns_updating_frame) - { - NSView *view =3D FRAME_NS_VIEW (f); - if (view !=3D focus_view) + if ([NSView focusView] =3D=3D FRAME_NS_VIEW (f)) { - if (focus_view !=3D NULL) - { - [focus_view unlockFocus]; - [[focus_view window] flushWindow]; -/* debug_lock--; */ - } + [[NSGraphicsContext currentContext] saveGraphicsState]; + if (n =3D=3D 2) + NSRectClipList (r, 2); + else + NSRectClip (*r); + gsaved =3D YES; = - if (view) - [view lockFocus]; - focus_view =3D view; -/* if (view) debug_lock++; */ + return YES; } - } - - /* clipping */ - if (r) - { - [[NSGraphicsContext currentContext] saveGraphicsState]; - if (n =3D=3D 2) - NSRectClipList (r, 2); else - NSRectClip (*r); - gsaved =3D YES; + { + NSView *view =3D FRAME_NS_VIEW (f); + int i; + for (i =3D 0 ; i < n ; i++) + [view setNeedsDisplayInRect:r[i]]; + } } + + return NO; } = = static void ns_unfocus (struct frame *f) -/* ---------------------------------------------------------------------= ----- - Internal: Remove focus on given frame - ---------------------------------------------------------------------= ----- */ +/* Internal: Restore the previous graphics state, unsetting any + clipping areas. */ { NSTRACE_WHEN (NSTRACE_GROUP_FOCUS, "ns_unfocus"); = @@ -1297,20 +1275,10 @@ static NSRect constrain_frame_rect(NSRect frameRe= ct, bool isFullscreen) gsaved =3D NO; } = - if (f !=3D ns_updating_frame) - { - if (focus_view !=3D NULL) - { - [focus_view unlockFocus]; - [[focus_view window] flushWindow]; - focus_view =3D NULL; -/* debug_lock--; */ - } - } } = = -static void +static BOOL ns_clip_to_row (struct window *w, struct glyph_row *row, enum glyph_row_area area, BOOL gc) /* ---------------------------------------------------------------------= ----- @@ -1329,7 +1297,17 @@ static NSRect constrain_frame_rect(NSRect frameRec= t, bool isFullscreen) clip_rect.size.width =3D window_width; clip_rect.size.height =3D row->visible_height; = - ns_focus (f, &clip_rect, 1); + return ns_focus (f, &clip_rect, 1); +} + + +static void +ns_flush_display (struct frame *f) +/* Force the frame to redisplay. If areas have previously been marked + dirty by setNeedsDisplayInRect (in ns_focus), then this will call + draw_rect: which will "expose" those areas. */ +{ + [FRAME_NS_VIEW (f) displayIfNeeded]; } = = @@ -2826,14 +2804,16 @@ so some key presses (TAB) are swallowed by the sy= stem. */ r =3D [view bounds]; = block_input (); - ns_focus (f, &r, 1); - [ns_lookup_indexed_color (NS_FACE_BACKGROUND - (FACE_FROM_ID (f, DEFAULT_FACE_ID)), f) set]; - NSRectFill (r); - ns_unfocus (f); - - /* as of 2006/11 or so this is now needed */ - ns_redraw_scroll_bars (f); + if (ns_focus (f, &r, 1)) + { + [ns_lookup_indexed_color (NS_FACE_BACKGROUND + (FACE_FROM_ID (f, DEFAULT_FACE_ID)), f) = set]; + NSRectFill (r); + ns_unfocus (f); + + /* as of 2006/11 or so this is now needed */ + ns_redraw_scroll_bars (f); + } unblock_input (); } = @@ -2854,13 +2834,14 @@ so some key presses (TAB) are swallowed by the sy= stem. */ NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_clear_frame_area"); = r =3D NSIntersectionRect (r, [view frame]); - ns_focus (f, &r, 1); - [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set]; + if (ns_focus (f, &r, 1)) + { + [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set]; = - NSRectFill (r); + NSRectFill (r); = - ns_unfocus (f); - return; + ns_unfocus (f); + } } = static void @@ -2872,11 +2853,11 @@ so some key presses (TAB) are swallowed by the sy= stem. */ { hide_bell(); // Ensure the bell image isn't scrolled.= = - ns_focus (f, &dest, 1); + /* FIXME: scrollRect:by: is deprecated in macOS 10.14. There is + no obvious replacement so we may have to come up with our own. = */ [FRAME_NS_VIEW (f) scrollRect: src by: NSMakeSize (dest.origin.x - src.ori= gin.x, dest.origin.y - src.ori= gin.y)]; - ns_unfocus (f); } } = @@ -3087,88 +3068,87 @@ so some key presses (TAB) are swallowed by the sy= stem. */ } = /* Must clip because of partially visible lines. */ - ns_clip_to_row (w, row, ANY_AREA, YES); - - if (!p->overlay_p) + if (ns_clip_to_row (w, row, ANY_AREA, YES)) { - int bx =3D p->bx, by =3D p->by, nx =3D p->nx, ny =3D p->ny; - - if (bx >=3D 0 && nx > 0) + if (!p->overlay_p) { - NSRect r =3D NSMakeRect (bx, by, nx, ny); - NSRectClip (r); - [ns_lookup_indexed_color (face->background, f) set]; - NSRectFill (r); - } - } - - if (p->which) - { - NSRect r =3D NSMakeRect (p->x, p->y, p->wd, p->h); - EmacsImage *img =3D bimgs[p->which - 1]; + int bx =3D p->bx, by =3D p->by, nx =3D p->nx, ny =3D p->ny; = - if (!img) - { - // Note: For "periodic" images, allocate one EmacsImage for - // the base image, and use it for all dh:s. - unsigned short *bits =3D p->bits; - int full_height =3D p->h + p->dh; - int i; - unsigned char *cbits =3D xmalloc (full_height); - - for (i =3D 0; i < full_height; i++) - cbits[i] =3D bits[i]; - img =3D [[EmacsImage alloc] initFromXBM: cbits width: 8 - height: full_height - fg: 0 bg: 0]; - bimgs[p->which - 1] =3D img; - xfree (cbits); + if (bx >=3D 0 && nx > 0) + { + NSRect r =3D NSMakeRect (bx, by, nx, ny); + NSRectClip (r); + [ns_lookup_indexed_color (face->background, f) set]; + NSRectFill (r); + } } = - NSTRACE_RECT ("r", r); + if (p->which) + { + NSRect r =3D NSMakeRect (p->x, p->y, p->wd, p->h); + EmacsImage *img =3D bimgs[p->which - 1]; = - NSRectClip (r); - /* Since we composite the bitmap instead of just blitting it, we n= eed - to erase the whole background. */ - [ns_lookup_indexed_color(face->background, f) set]; - NSRectFill (r); + if (!img) + { + // Note: For "periodic" images, allocate one EmacsImage fo= r + // the base image, and use it for all dh:s. + unsigned short *bits =3D p->bits; + int full_height =3D p->h + p->dh; + int i; + unsigned char *cbits =3D xmalloc (full_height); + + for (i =3D 0; i < full_height; i++) + cbits[i] =3D bits[i]; + img =3D [[EmacsImage alloc] initFromXBM: cbits width: 8 + height: full_height + fg: 0 bg: 0]; + bimgs[p->which - 1] =3D img; + xfree (cbits); + } = - { - NSColor *bm_color; - if (!p->cursor_p) - bm_color =3D ns_lookup_indexed_color(face->foreground, f); - else if (p->overlay_p) - bm_color =3D ns_lookup_indexed_color(face->background, f); - else - bm_color =3D f->output_data.ns->cursor_color; - [img setXBMColor: bm_color]; - } + NSTRACE_RECT ("r", r); = -#ifdef NS_IMPL_COCOA - // Note: For periodic images, the full image height is "h + hd". - // By using the height h, a suitable part of the image is used. - NSRect fromRect =3D NSMakeRect(0, 0, p->wd, p->h); + NSRectClip (r); + /* Since we composite the bitmap instead of just blitting it, = we need + to erase the whole background. */ + [ns_lookup_indexed_color(face->background, f) set]; + NSRectFill (r); = - NSTRACE_RECT ("fromRect", fromRect); + { + NSColor *bm_color; + if (!p->cursor_p) + bm_color =3D ns_lookup_indexed_color(face->foreground, f);= + else if (p->overlay_p) + bm_color =3D ns_lookup_indexed_color(face->background, f);= + else + bm_color =3D f->output_data.ns->cursor_color; + [img setXBMColor: bm_color]; + } = - [img drawInRect: r - fromRect: fromRect - operation: NSCompositingOperationSourceOver - fraction: 1.0 - respectFlipped: YES - hints: nil]; +#ifdef NS_IMPL_COCOA + // Note: For periodic images, the full image height is "h + hd= ". + // By using the height h, a suitable part of the image is used= =2E + NSRect fromRect =3D NSMakeRect(0, 0, p->wd, p->h); + + NSTRACE_RECT ("fromRect", fromRect); + + [img drawInRect: r + fromRect: fromRect + operation: NSCompositingOperationSourceOver + fraction: 1.0 + respectFlipped: YES + hints: nil]; #else - { - NSPoint pt =3D r.origin; - pt.y +=3D p->h; - [img compositeToPoint: pt operation: NSCompositingOperationSourc= eOver]; - } + { + NSPoint pt =3D r.origin; + pt.y +=3D p->h; + [img compositeToPoint: pt operation: NSCompositingOperationS= ourceOver]; + } #endif + } + ns_unfocus (f); } - ns_unfocus (f); } - - static void ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x, int y, enum text_cursor_kinds cursor_type, @@ -3248,66 +3228,65 @@ Note that CURSOR_WIDTH is meaningful only for (h)= bar cursors. r.size.width =3D w->phys_cursor_width; = /* Prevent the cursor from being drawn outside the text area. */ - ns_clip_to_row (w, glyph_row, TEXT_AREA, NO); /* do ns_focus(f, &r, 1)= ; if remove */ - - - face =3D FACE_FROM_ID_OR_NULL (f, phys_cursor_glyph->face_id); - if (face && NS_FACE_BACKGROUND (face) - =3D=3D ns_index_color (FRAME_CURSOR_COLOR (f), f)) + if (ns_clip_to_row (w, glyph_row, TEXT_AREA, NO)) { - [ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), f) set]; - hollow_color =3D FRAME_CURSOR_COLOR (f); - } - else - [FRAME_CURSOR_COLOR (f) set]; + face =3D FACE_FROM_ID_OR_NULL (f, phys_cursor_glyph->face_id); + if (face && NS_FACE_BACKGROUND (face) + =3D=3D ns_index_color (FRAME_CURSOR_COLOR (f), f)) + { + [ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), f) set]; + hollow_color =3D FRAME_CURSOR_COLOR (f); + } + else + [FRAME_CURSOR_COLOR (f) set]; = #ifdef NS_IMPL_COCOA - /* TODO: This makes drawing of cursor plus that of phys_cursor_glyph - atomic. Cleaner ways of doing this should be investigated. - One way would be to set a global variable DRAWING_CURSOR - when making the call to draw_phys..(), don't focus in that - case, then move the ns_unfocus() here after that call. */ - NSDisableScreenUpdates (); + /* TODO: This makes drawing of cursor plus that of phys_cursor_gly= ph + atomic. Cleaner ways of doing this should be investigated. + One way would be to set a global variable DRAWING_CURSOR + when making the call to draw_phys..(), don't focus in that + case, then move the ns_unfocus() here after that call. */ + NSDisableScreenUpdates (); #endif = - switch (cursor_type) - { - case DEFAULT_CURSOR: - case NO_CURSOR: - break; - case FILLED_BOX_CURSOR: - NSRectFill (r); - break; - case HOLLOW_BOX_CURSOR: - NSRectFill (r); - [hollow_color set]; - NSRectFill (NSInsetRect (r, 1, 1)); - [FRAME_CURSOR_COLOR (f) set]; - break; - case HBAR_CURSOR: - NSRectFill (r); - break; - case BAR_CURSOR: - s =3D r; - /* If the character under cursor is R2L, draw the bar cursor - on the right of its glyph, rather than on the left. */ - cursor_glyph =3D get_phys_cursor_glyph (w); - if ((cursor_glyph->resolved_level & 1) !=3D 0) - s.origin.x +=3D cursor_glyph->pixel_width - s.size.width; - - NSRectFill (s); - break; - } - ns_unfocus (f); + switch (cursor_type) + { + case DEFAULT_CURSOR: + case NO_CURSOR: + break; + case FILLED_BOX_CURSOR: + NSRectFill (r); + break; + case HOLLOW_BOX_CURSOR: + NSRectFill (r); + [hollow_color set]; + NSRectFill (NSInsetRect (r, 1, 1)); + [FRAME_CURSOR_COLOR (f) set]; + break; + case HBAR_CURSOR: + NSRectFill (r); + break; + case BAR_CURSOR: + s =3D r; + /* If the character under cursor is R2L, draw the bar cursor + on the right of its glyph, rather than on the left. */ + cursor_glyph =3D get_phys_cursor_glyph (w); + if ((cursor_glyph->resolved_level & 1) !=3D 0) + s.origin.x +=3D cursor_glyph->pixel_width - s.size.width; + + NSRectFill (s); + break; + } + ns_unfocus (f); = - /* draw the character under the cursor */ - if (cursor_type !=3D NO_CURSOR) - draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR); + /* draw the character under the cursor */ + if (cursor_type !=3D NO_CURSOR) + draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR); = #ifdef NS_IMPL_COCOA - NSEnableScreenUpdates (); + NSEnableScreenUpdates (); #endif - + } } = = @@ -3325,12 +3304,14 @@ Note that CURSOR_WIDTH is meaningful only for (h)= bar cursors. = face =3D FACE_FROM_ID_OR_NULL (f, VERTICAL_BORDER_FACE_ID); = - ns_focus (f, &r, 1); - if (face) - [ns_lookup_indexed_color(face->foreground, f) set]; + if (ns_focus (f, &r, 1)) + { + if (face) + [ns_lookup_indexed_color(face->foreground, f) set]; = - NSRectFill(r); - ns_unfocus (f); + NSRectFill(r); + ns_unfocus (f); + } } = = @@ -3357,39 +3338,40 @@ Note that CURSOR_WIDTH is meaningful only for (h)= bar cursors. = NSTRACE ("ns_draw_window_divider"); = - ns_focus (f, ÷r, 1); - - if ((y1 - y0 > x1 - x0) && (x1 - x0 >=3D 3)) - /* A vertical divider, at least three pixels wide: Draw first and - last pixels differently. */ + if (ns_focus (f, ÷r, 1)) { - [ns_lookup_indexed_color(color_first, f) set]; - NSRectFill(NSMakeRect (x0, y0, 1, y1 - y0)); - [ns_lookup_indexed_color(color, f) set]; - NSRectFill(NSMakeRect (x0 + 1, y0, x1 - x0 - 2, y1 - y0)); - [ns_lookup_indexed_color(color_last, f) set]; - NSRectFill(NSMakeRect (x1 - 1, y0, 1, y1 - y0)); - } - else if ((x1 - x0 > y1 - y0) && (y1 - y0 >=3D 3)) - /* A horizontal divider, at least three pixels high: Draw first and - last pixels differently. */ - { - [ns_lookup_indexed_color(color_first, f) set]; - NSRectFill(NSMakeRect (x0, y0, x1 - x0, 1)); - [ns_lookup_indexed_color(color, f) set]; - NSRectFill(NSMakeRect (x0, y0 + 1, x1 - x0, y1 - y0 - 2)); - [ns_lookup_indexed_color(color_last, f) set]; - NSRectFill(NSMakeRect (x0, y1 - 1, x1 - x0, 1)); - } - else - { - /* In any other case do not draw the first and last pixels - differently. */ - [ns_lookup_indexed_color(color, f) set]; - NSRectFill(divider); - } + if ((y1 - y0 > x1 - x0) && (x1 - x0 >=3D 3)) + /* A vertical divider, at least three pixels wide: Draw first an= d + last pixels differently. */ + { + [ns_lookup_indexed_color(color_first, f) set]; + NSRectFill(NSMakeRect (x0, y0, 1, y1 - y0)); + [ns_lookup_indexed_color(color, f) set]; + NSRectFill(NSMakeRect (x0 + 1, y0, x1 - x0 - 2, y1 - y0)); + [ns_lookup_indexed_color(color_last, f) set]; + NSRectFill(NSMakeRect (x1 - 1, y0, 1, y1 - y0)); + } + else if ((x1 - x0 > y1 - y0) && (y1 - y0 >=3D 3)) + /* A horizontal divider, at least three pixels high: Draw first = and + last pixels differently. */ + { + [ns_lookup_indexed_color(color_first, f) set]; + NSRectFill(NSMakeRect (x0, y0, x1 - x0, 1)); + [ns_lookup_indexed_color(color, f) set]; + NSRectFill(NSMakeRect (x0, y0 + 1, x1 - x0, y1 - y0 - 2)); + [ns_lookup_indexed_color(color_last, f) set]; + NSRectFill(NSMakeRect (x0, y1 - 1, x1 - x0, 1)); + } + else + { + /* In any other case do not draw the first and last pixels + differently. */ + [ns_lookup_indexed_color(color, f) set]; + NSRectFill(divider); + } = - ns_unfocus (f); + ns_unfocus (f); + } } = static void @@ -3988,83 +3970,84 @@ Function modeled after x_draw_glyph_string_box ()= =2E n =3D ns_get_glyph_string_clip_rect (s, r); *r =3D NSMakeRect (s->x, s->y, s->background_width, s->height); = - ns_focus (s->f, r, n); - - if (s->hl =3D=3D DRAW_MOUSE_FACE) - { - face =3D FACE_FROM_ID_OR_NULL (s->f, - MOUSE_HL_INFO (s->f)->mouse_face_face_id); - if (!face) - face =3D FACE_FROM_ID (s->f, MOUSE_FACE_ID); - } - else - face =3D FACE_FROM_ID (s->f, s->first_glyph->face_id); - - bgCol =3D ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f= ); - fgCol =3D ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f= ); - - for (i =3D 0; i < n; ++i) + if (ns_focus (s->f, r, n)) { - if (!s->row->full_width_p) + if (s->hl =3D=3D DRAW_MOUSE_FACE) { - int overrun, leftoverrun; - - /* truncate to avoid overwriting fringe and/or scrollbar *= / - overrun =3D max (0, (s->x + s->background_width) - - (WINDOW_BOX_RIGHT_EDGE_X (s->w) - - WINDOW_RIGHT_FRINGE_WIDTH (s->w))); - r[i].size.width -=3D overrun; - - /* truncate to avoid overwriting to left of the window box */ - leftoverrun =3D (WINDOW_BOX_LEFT_EDGE_X (s->w) - + WINDOW_LEFT_FRINGE_WIDTH (s->w)) - s->x; - - if (leftoverrun > 0) - { - r[i].origin.x +=3D leftoverrun; - r[i].size.width -=3D leftoverrun; - } - - /* XXX: Try to work between problem where a stretch glyph = on - a partially-visible bottom row will clear part of the - modeline, and another where list-buffers headers and si= milar - rows erroneously have visible_height set to 0. Not sur= e - where this is coming from as other terms seem not to sh= ow. */ - r[i].size.height =3D min (s->height, s->row->visible_heigh= t); + face =3D FACE_FROM_ID_OR_NULL (s->f, + MOUSE_HL_INFO (s->f)->mouse_f= ace_face_id); + if (!face) + face =3D FACE_FROM_ID (s->f, MOUSE_FACE_ID); } + else + face =3D FACE_FROM_ID (s->f, s->first_glyph->face_id); = - [bgCol set]; + bgCol =3D ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), = s->f); + fgCol =3D ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), = s->f); = - /* NOTE: under NS this is NOT used to draw cursors, but we mus= t avoid - overwriting cursor (usually when cursor on a tab). */ - if (s->hl =3D=3D DRAW_CURSOR) + for (i =3D 0; i < n; ++i) { - CGFloat x, width; + if (!s->row->full_width_p) + { + int overrun, leftoverrun; + + /* truncate to avoid overwriting fringe and/or scrollb= ar */ + overrun =3D max (0, (s->x + s->background_width) + - (WINDOW_BOX_RIGHT_EDGE_X (s->w) + - WINDOW_RIGHT_FRINGE_WIDTH (s->w)))= ; + r[i].size.width -=3D overrun; + + /* truncate to avoid overwriting to left of the window= box */ + leftoverrun =3D (WINDOW_BOX_LEFT_EDGE_X (s->w) + + WINDOW_LEFT_FRINGE_WIDTH (s->w)) - s-= >x; + + if (leftoverrun > 0) + { + r[i].origin.x +=3D leftoverrun; + r[i].size.width -=3D leftoverrun; + } + + /* XXX: Try to work between problem where a stretch = glyph on + a partially-visible bottom row will clear part of= the + modeline, and another where list-buffers headers = and similar + rows erroneously have visible_height set to 0. N= ot sure + where this is coming from as other terms seem not= to show. */ + r[i].size.height =3D min (s->height, s->row->visible= _height); + } + + [bgCol set]; + + /* NOTE: under NS this is NOT used to draw cursors, but we= must avoid + overwriting cursor (usually when cursor on a tab). */ + if (s->hl =3D=3D DRAW_CURSOR) + { + CGFloat x, width; = - x =3D r[i].origin.x; - width =3D s->w->phys_cursor_width; - r[i].size.width -=3D width; - r[i].origin.x +=3D width; + x =3D r[i].origin.x; + width =3D s->w->phys_cursor_width; + r[i].size.width -=3D width; + r[i].origin.x +=3D width; = - NSRectFill (r[i]); + NSRectFill (r[i]); = - /* Draw overlining, etc. on the cursor. */ - if (s->w->phys_cursor_type =3D=3D FILLED_BOX_CURSOR) - ns_draw_text_decoration (s, face, bgCol, width, x); + /* Draw overlining, etc. on the cursor. */ + if (s->w->phys_cursor_type =3D=3D FILLED_BOX_CURSOR) + ns_draw_text_decoration (s, face, bgCol, width, x); + else + ns_draw_text_decoration (s, face, fgCol, width, x); + } else - ns_draw_text_decoration (s, face, fgCol, width, x); - } - else - { - NSRectFill (r[i]); - } + { + NSRectFill (r[i]); + } = - /* Draw overlining, etc. on the stretch glyph (or the part - of the stretch glyph after the cursor). */ - ns_draw_text_decoration (s, face, fgCol, r[i].size.width, - r[i].origin.x); + /* Draw overlining, etc. on the stretch glyph (or the part= + of the stretch glyph after the cursor). */ + ns_draw_text_decoration (s, face, fgCol, r[i].size.width, + r[i].origin.x); + } + ns_unfocus (s->f); } - ns_unfocus (s->f); s->background_filled_p =3D 1; } } @@ -4214,9 +4197,11 @@ overwriting cursor (usually when cursor on a tab).= */ if (next->first_glyph->type !=3D STRETCH_GLYPH) { n =3D ns_get_glyph_string_clip_rect (s->next, r); - ns_focus (s->f, r, n); - ns_maybe_dumpglyphs_background (s->next, 1); - ns_unfocus (s->f); + if (ns_focus (s->f, r, n)) + { + ns_maybe_dumpglyphs_background (s->next, 1); + ns_unfocus (s->f); + } } else { @@ -4231,10 +4216,12 @@ overwriting cursor (usually when cursor on a tab)= =2E */ || s->first_glyph->type =3D=3D COMPOSITE_GLYPH)) { n =3D ns_get_glyph_string_clip_rect (s, r); - ns_focus (s->f, r, n); - ns_maybe_dumpglyphs_background (s, 1); - ns_dumpglyphs_box_or_relief (s); - ns_unfocus (s->f); + if (ns_focus (s->f, r, n)) + { + ns_maybe_dumpglyphs_background (s, 1); + ns_dumpglyphs_box_or_relief (s); + ns_unfocus (s->f); + } box_drawn_p =3D 1; } = @@ -4243,9 +4230,11 @@ overwriting cursor (usually when cursor on a tab).= */ = case IMAGE_GLYPH: n =3D ns_get_glyph_string_clip_rect (s, r); - ns_focus (s->f, r, n); - ns_dumpglyphs_image (s, r[0]); - ns_unfocus (s->f); + if (ns_focus (s->f, r, n)) + { + ns_dumpglyphs_image (s, r[0]); + ns_unfocus (s->f); + } break; = case STRETCH_GLYPH: @@ -4255,66 +4244,68 @@ overwriting cursor (usually when cursor on a tab)= =2E */ case CHAR_GLYPH: case COMPOSITE_GLYPH: n =3D ns_get_glyph_string_clip_rect (s, r); - ns_focus (s->f, r, n); + if (ns_focus (s->f, r, n)) + { + if (s->for_overlaps || (s->cmp_from > 0 + && ! s->first_glyph->u.cmp.automatic))= + s->background_filled_p =3D 1; + else + ns_maybe_dumpglyphs_background + (s, s->first_glyph->type =3D=3D COMPOSITE_GLYPH); = - if (s->for_overlaps || (s->cmp_from > 0 - && ! s->first_glyph->u.cmp.automatic)) - s->background_filled_p =3D 1; - else - ns_maybe_dumpglyphs_background - (s, s->first_glyph->type =3D=3D COMPOSITE_GLYPH); + if (s->hl =3D=3D DRAW_CURSOR && s->w->phys_cursor_type =3D=3D = FILLED_BOX_CURSOR) + { + unsigned long tmp =3D NS_FACE_BACKGROUND (s->face); + NS_FACE_BACKGROUND (s->face) =3D NS_FACE_FOREGROUND (s->fa= ce); + NS_FACE_FOREGROUND (s->face) =3D tmp; + } = - if (s->hl =3D=3D DRAW_CURSOR && s->w->phys_cursor_type =3D=3D FILL= ED_BOX_CURSOR) - { - unsigned long tmp =3D NS_FACE_BACKGROUND (s->face); - NS_FACE_BACKGROUND (s->face) =3D NS_FACE_FOREGROUND (s->face);= - NS_FACE_FOREGROUND (s->face) =3D tmp; - } + { + BOOL isComposite =3D s->first_glyph->type =3D=3D COMPOSITE_G= LYPH; = - { - BOOL isComposite =3D s->first_glyph->type =3D=3D COMPOSITE_GLYPH= ; + if (isComposite) + ns_draw_composite_glyph_string_foreground (s); + else + ns_draw_glyph_string_foreground (s); + } = - if (isComposite) - ns_draw_composite_glyph_string_foreground (s); - else - ns_draw_glyph_string_foreground (s); - } + { + NSColor *col =3D (NS_FACE_FOREGROUND (s->face) !=3D 0 + ? ns_lookup_indexed_color (NS_FACE_FOREGROUN= D (s->face), + s->f) + : FRAME_FOREGROUND_COLOR (s->f)); + [col set]; + + /* Draw underline, overline, strike-through. */ + ns_draw_text_decoration (s, s->face, col, s->width, s->x); + } = - { - NSColor *col =3D (NS_FACE_FOREGROUND (s->face) !=3D 0 - ? ns_lookup_indexed_color (NS_FACE_FOREGROUND (s= ->face), - s->f) - : FRAME_FOREGROUND_COLOR (s->f)); - [col set]; - - /* Draw underline, overline, strike-through. */ - ns_draw_text_decoration (s, s->face, col, s->width, s->x); - } + if (s->hl =3D=3D DRAW_CURSOR && s->w->phys_cursor_type =3D=3D = FILLED_BOX_CURSOR) + { + unsigned long tmp =3D NS_FACE_BACKGROUND (s->face); + NS_FACE_BACKGROUND (s->face) =3D NS_FACE_FOREGROUND (s->fa= ce); + NS_FACE_FOREGROUND (s->face) =3D tmp; + } = - if (s->hl =3D=3D DRAW_CURSOR && s->w->phys_cursor_type =3D=3D FILL= ED_BOX_CURSOR) - { - unsigned long tmp =3D NS_FACE_BACKGROUND (s->face); - NS_FACE_BACKGROUND (s->face) =3D NS_FACE_FOREGROUND (s->face);= - NS_FACE_FOREGROUND (s->face) =3D tmp; + ns_unfocus (s->f); } - - ns_unfocus (s->f); break; = case GLYPHLESS_GLYPH: n =3D ns_get_glyph_string_clip_rect (s, r); - ns_focus (s->f, r, n); - - if (s->for_overlaps || (s->cmp_from > 0 - && ! s->first_glyph->u.cmp.automatic)) - s->background_filled_p =3D 1; - else - ns_maybe_dumpglyphs_background - (s, s->first_glyph->type =3D=3D COMPOSITE_GLYPH); - /* ... */ - /* Not yet implemented. */ - /* ... */ - ns_unfocus (s->f); + if (ns_focus (s->f, r, n)) + { + if (s->for_overlaps || (s->cmp_from > 0 + && ! s->first_glyph->u.cmp.automatic))= + s->background_filled_p =3D 1; + else + ns_maybe_dumpglyphs_background + (s, s->first_glyph->type =3D=3D COMPOSITE_GLYPH); + /* ... */ + /* Not yet implemented. */ + /* ... */ + ns_unfocus (s->f); + } break; = default: @@ -4325,9 +4316,11 @@ overwriting cursor (usually when cursor on a tab).= */ if (!s->for_overlaps && !box_drawn_p && s->face->box !=3D FACE_NO_BOX)= { n =3D ns_get_glyph_string_clip_rect (s, r); - ns_focus (s->f, r, n); - ns_dumpglyphs_box_or_relief (s); - ns_unfocus (s->f); + if (ns_focus (s->f, r, n)) + { + ns_dumpglyphs_box_or_relief (s); + ns_unfocus (s->f); + } } = s->num_clips =3D 0; @@ -5133,7 +5126,7 @@ static Lisp_Object ns_string_to_lispmod (const char= *s) ns_after_update_window_line, ns_update_window_begin, ns_update_window_end, - 0, /* flush_display */ + ns_flush_display, /* flush_display */ x_clear_window_mouse_face, x_get_glyph_overhangs, x_fix_overlapping_area, -- = 2.19.0 --=_MailMate_15D6F859-CEB5-4223-ACEC-B3386C3809D5_=-- From unknown Sat Jun 21 03:30:02 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32812: 27.0.50; macOS Mojave GNU Emacs crash after 5-10 minutes or so Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Sep 2018 10:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32812 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Zack Piper Cc: 32812@debbugs.gnu.org Received: via spool by 32812-submit@debbugs.gnu.org id=B32812.153778423924982 (code B ref 32812); Mon, 24 Sep 2018 10:18:02 +0000 Received: (at 32812) by debbugs.gnu.org; 24 Sep 2018 10:17:19 +0000 Received: from localhost ([127.0.0.1]:51361 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4Nva-0006Us-Ks for submit@debbugs.gnu.org; Mon, 24 Sep 2018 06:17:18 -0400 Received: from mail-wm1-f49.google.com ([209.85.128.49]:51335) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4NvY-0006Ue-BB for 32812@debbugs.gnu.org; Mon, 24 Sep 2018 06:17:16 -0400 Received: by mail-wm1-f49.google.com with SMTP id y25-v6so1645801wmi.1 for <32812@debbugs.gnu.org>; Mon, 24 Sep 2018 03:17:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=HTbvse2GL0N4v9ZoRn9hjwsOXfkQy67VmcVdcs5A2pc=; b=cKInaFduhUNVRCpNLpRKxsC6X9DrtBBOXws/e2FO1bQiFazgsxRGZh6RP5hyGjv4Sp pzytRkB05uzPVuubcib6MS1nFiuuS030ZBGbvkDmcvZhW9NitW/1MX+LF6DrZMgh51PM FauzJ8ou9qyG6Y4EtTn0/jiWcCOaATZ1zBzqqFxrSwWODsQ4tm30+XC3Ay1IcnLU/13t EyB1WVk3uxfo+gIZmDgkUKbpB6/vIAygUacZXaBhvFb3LkSd86EUEEtvw6b/yJ8yBqzj aFfTprdSjQ+t9x2kRxsHnOlcWwdUNRYj2cL6uKoFMXLox9rbLa4jscX1heIIIQaajH+l 5ajQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=HTbvse2GL0N4v9ZoRn9hjwsOXfkQy67VmcVdcs5A2pc=; b=RqqUVNFF3CU3t3s//qiaKv2BoAcjGufSbczaTYPoGYlPJle2uf62blT0RGcCHwZVQQ UGs6s9Yf1kQC15ANiJAZMJj29UF9y30V+r3pGyX3QYtV9spzkLUHoJ4yz/yih0UByO7u A5/8/QbLFc1ioKji7TLYvQpRMTLcSYq9OjMpDkXxMR73OpoaAfC6c+cwZry6Zr2QGYv0 kOa+HkK+2M/cPOU2OPv8nqjskBxHJEJZAgRjz/DWbmnOHjyuCikY8Mygpm1Ft5n8BV5y 7WwanHC4ZnE98ed5D20w8opYmbNZi6R8wpW9JvzvT8XMp17iUgxOE9Rfvv7nLZKVCAaO 1Niw== X-Gm-Message-State: ABuFfoj80/AVEVZWAj+0lJYJ4Qaclyw+gUjqOn13uWdBNWSBtjF5A2ip EVLpef8Vm5G75DR4M4m7m6V3ilXi X-Google-Smtp-Source: ACcGV61eHPl79SQ6G/tdBogysqWidGUAOo50wJRIxMDLg2Q1AGHHPPZCreYCiOhtRWBZpVoBRM6t5A== X-Received: by 2002:a1c:950f:: with SMTP id x15-v6mr6311684wmd.157.1537784230432; Mon, 24 Sep 2018 03:17:10 -0700 (PDT) Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-685d-0823-64c8-95c1.holly.idiocy.org. [2001:8b0:3f8:8129:685d:823:64c8:95c1]) by smtp.gmail.com with ESMTPSA id h206-v6sm16703397wmf.25.2018.09.24.03.17.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Sep 2018 03:17:08 -0700 (PDT) Date: Mon, 24 Sep 2018 11:17:06 +0100 From: Alan Third Message-ID: <20180924101706.GA24015@breton.holly.idiocy.org> References: <8C435A35-6F98-45D4-AF3E-1052E9420212@apertron.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="PEIAKu/WMn1b1Hv9" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <8C435A35-6F98-45D4-AF3E-1052E9420212@apertron.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Score: 0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Sun, Sep 23, 2018 at 04:21:13PM +0100, Zack Piper wrote: > Hi! > > (Replacing my post in #31904 with this since they're separate issues(?)) Sorry, I somehow missed that previous email. > I've applied a slightly modified (i.e. updated) version of Alan's patch from > bug #31904 > (attached) to fix an issue concerning the buffer and mode-line not being > rendered. The patch works great, everything is now rendered. > > Now I notice that after 5-10 minutes (or even before), Emacs crashes with > the below: > > ``` > objc[82784]: Invalid or prematurely-freed autorelease pool 0x1030032e0. > ``` > > This started occurring since upgrading to macOS Mojave, so possibly there's > a bug with Mojave or just some incompatibility, not really sure! It’s a bit strange looking, and autorelease pools are something of a mystery to me. I have a suspicion, though, that just creating a new autorelease pool may solve this. I’ve attached a patch. It’s for emacs-26, but should apply OK to master, or without too much work anyway. It simply wraps the call to displayIfNeeded in a new pool: static void ns_flush_display (struct frame *f) /* Force the frame to redisplay. If areas have previously been marked dirty by setNeedsDisplayInRect (in ns_focus), then this will call draw_rect: which will "expose" those areas. */ { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [FRAME_NS_VIEW (f) displayIfNeeded]; [pool release]; } Thanks for testing the patch and raising this issue. There’s not been a lot of feedback so far and I think we’re going to have to commit the patch soon given that Mojave is out today. -- Alan Third --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-Fix-crash-when-flushing-to-screen-bug-32812.patch" >From 17bab071cc15aa378e96913ea84167fc4af88f02 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Mon, 24 Sep 2018 11:02:41 +0100 Subject: [PATCH] Fix crash when flushing to screen (bug#32812) * src/nsterm.m (ns_flush_display): Create a new autorelease pool for the display code. --- src/nsterm.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/nsterm.m b/src/nsterm.m index b36d847eb3..d6f6d8afee 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1252,7 +1252,9 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen) dirty by setNeedsDisplayInRect (in ns_focus), then this will call draw_rect: which will "expose" those areas. */ { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [FRAME_NS_VIEW (f) displayIfNeeded]; + [pool release]; } -- 2.18.0 --PEIAKu/WMn1b1Hv9-- From unknown Sat Jun 21 03:30:02 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32812: 27.0.50; macOS Mojave GNU Emacs crash after 5-10 minutes or so Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Sep 2018 10:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32812 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Zack Piper Cc: 32812@debbugs.gnu.org Received: via spool by 32812-submit@debbugs.gnu.org id=B32812.153778468325800 (code B ref 32812); Mon, 24 Sep 2018 10:25:02 +0000 Received: (at 32812) by debbugs.gnu.org; 24 Sep 2018 10:24:43 +0000 Received: from localhost ([127.0.0.1]:51374 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4O2l-0006i4-0p for submit@debbugs.gnu.org; Mon, 24 Sep 2018 06:24:43 -0400 Received: from mail-wm1-f51.google.com ([209.85.128.51]:55958) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4O2j-0006hp-Ur for 32812@debbugs.gnu.org; Mon, 24 Sep 2018 06:24:42 -0400 Received: by mail-wm1-f51.google.com with SMTP id 206-v6so1179707wmb.5 for <32812@debbugs.gnu.org>; Mon, 24 Sep 2018 03:24:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=2MIDbQknx7OmP3X0764xlPj5Na9JZLN30bsKuDAELlI=; b=MRwIiTnE1SZ3z7mjm95+qaFF/PANn/a/epNEFnzXFQeLfUGw/CZI8U+hxu63vpFma7 QxzeuW6l75F+6lX/mIsoaur5dSPNVIhfcrDvZVurYK0Cg41ZhKcYqbKeLMQtJiFTmw4R TYkl9qaQqA+Zp5m7JGuQaDFLPja8PriW48ks3JlJp2VKqRz7c3+hHjqGS0cniIj7TKry yIncqXXDrKoJG6ZKAlhMT2YXY3otLgOJYty6JW2aRcATUpjz4T6LPoKk+TjYqgV3XAKu KDaXseErqWhdtF9kZvANH0Z0dTURnxMRqtNaNgp5pNZPthU0ItLPcvAwZsjsls2ZFGxG spbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=2MIDbQknx7OmP3X0764xlPj5Na9JZLN30bsKuDAELlI=; b=YYQNC1yDxbkrtOdEms1DPaJQXeXGJjxK9MNmKdX4YWdElvq0DxT/jot2mqwchAjPAL kbNpPHnbcwGWetSWaUiY5xIJx6B4idzDGi7mKtPK7m+AzlP3/0TbG2zX9/LcNTE+Sb2O ETKuYLhKDFP7SETTAtGdXadcZjQgraZ3CbL6TlLPwrJuqOvAL6L242AbmorktrQCnvll F5jDcbaEgygoh42BDefuQmL3opHRv/iLrudlAXfomPrqT2KuT7LYRaFY0fI2daEboJ4s Ij3IKOgk9dDlsCjKQsio9O+wkbLtkQmLiSxz02hjB6tFDnZMNEjPlAqLK2RImKYhpmtC CTOQ== X-Gm-Message-State: APzg51BaRdeWT8CjfnntsSgUKXEoz1JLLJuOrKAgXbv0PmZU7/s/VjTK zLR0yKUytCeI6tvkfkQuAhE= X-Google-Smtp-Source: ACcGV62T5ptxsqGwghXjqzbdTJHHWbTQ42cVsZolksspDjxuB7BgaFiPwvGnVPDEWwl1Ocm5/sCwww== X-Received: by 2002:a1c:2905:: with SMTP id p5-v6mr6379966wmp.1.1537784676204; Mon, 24 Sep 2018 03:24:36 -0700 (PDT) Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-685d-0823-64c8-95c1.holly.idiocy.org. [2001:8b0:3f8:8129:685d:823:64c8:95c1]) by smtp.gmail.com with ESMTPSA id b74-v6sm22376375wma.8.2018.09.24.03.24.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Sep 2018 03:24:35 -0700 (PDT) Date: Mon, 24 Sep 2018 11:24:33 +0100 From: Alan Third Message-ID: <20180924102433.GA25858@breton.holly.idiocy.org> References: <8C435A35-6F98-45D4-AF3E-1052E9420212@apertron.com> <20180924101706.GA24015@breton.holly.idiocy.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180924101706.GA24015@breton.holly.idiocy.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Score: 0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) On Mon, Sep 24, 2018 at 11:17:06AM +0100, Alan Third wrote: > > It’s a bit strange looking, and autorelease pools are something of a > mystery to me. > > I have a suspicion, though, that just creating a new autorelease pool > may solve this. I’ve attached a patch. It’s for emacs-26, but should > apply OK to master, or without too much work anyway. This patch doesn’t help, I finally reproduced the crash with it in place. -- Alan Third From unknown Sat Jun 21 03:30:02 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32812: 27.0.50; macOS Mojave GNU Emacs crash after 5-10 minutes or so Resent-From: "Zack Piper" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Sep 2018 11:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32812 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 32812@debbugs.gnu.org Received: via spool by 32812-submit@debbugs.gnu.org id=B32812.15377891709489 (code B ref 32812); Mon, 24 Sep 2018 11:40:02 +0000 Received: (at 32812) by debbugs.gnu.org; 24 Sep 2018 11:39:30 +0000 Received: from localhost ([127.0.0.1]:51399 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4PD7-0002Sy-Mb for submit@debbugs.gnu.org; Mon, 24 Sep 2018 07:39:29 -0400 Received: from 183.ip-51-68-126.eu ([51.68.126.183]:37284 helo=zmail.apertron.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4PD5-0002Sq-6l for 32812@debbugs.gnu.org; Mon, 24 Sep 2018 07:39:28 -0400 Received: from [172.25.55.63] (unknown [86.8.202.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: zack@apertron.com) by zmail.apertron.com (Postfix) with ESMTPSA id 318C66002A for <32812@debbugs.gnu.org>; Mon, 24 Sep 2018 11:39:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apertron.com; s=dkim; t=1537789159; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2/cpk6bxhSCnU4MsFz6UkdG8db8WRcuaxeAjRIHEm5Y=; b=kfNrK1HvdhZmMAYLXxRdddEAyZdQKa3RaeWrQJ7sqY5YKvyge0Ti0BHevwHjKCOZuTqn7e 7odPVDJQrGs2C6rZ/oeisNByZ952y3gSZtGwhDOxYC7+NmUeuq043M96TGYxMJ9Rskt4V9 GHeT9yz9YoWpJJ1YDArB0gjofIiaUA4= From: "Zack Piper" Date: Mon, 24 Sep 2018 12:39:22 +0100 Message-ID: <44769E5D-B37C-48AF-9C17-38264CE6224A@apertron.com> In-Reply-To: <20180924101706.GA24015@breton.holly.idiocy.org> References: <8C435A35-6F98-45D4-AF3E-1052E9420212@apertron.com> <20180924101706.GA24015@breton.holly.idiocy.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=apertron.com; s=dkim; t=1537789159; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2/cpk6bxhSCnU4MsFz6UkdG8db8WRcuaxeAjRIHEm5Y=; b=Nz6T9E+nJTjA2goRiD7EsqYzd5qCUhxouGtF4zAMjfd+ZkTCs3zakQ4MGoHq788Um4qROY 6qoUrV+I7izsjbuG9S05hDP8kvB5aXnAZHwtDOqQgu0QwPHq58kx0A3ruc5Ee54WmoxhZh +cc6JiA1CAOdD/pjYjxfKMdAYusAK30= ARC-Seal: i=1; s=dkim; d=apertron.com; t=1537789159; a=rsa-sha256; cv=none; b=a2aQWGWPbem7VVgewYzdM0Joq1sk/U9YEmmL42tmY5ije525sZaIDtbvpGEo7fnhbqViBqagm3lCq57evgB/S6yAs5i1LgKT5Hji2hADcpeF6scPvJKOnpfYTlU0R1ByDAEWb8V+oahgaArfy9MP0Oz+t/g6AhHhHT4Hj+EWvhQ= ARC-Authentication-Results: i=1; zmail.apertron.com; auth=pass smtp.auth=zack@apertron.com smtp.mailfrom=zack@apertron.com X-Spam-Score: 2.4 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: (Final attempt at sending, TLS was being enforced for my outgoing emails, sorry Alan for the spam!) Hi Alan, On 24 Sep 2018, at 11:17, Alan Third wrote: [...] Content analysis details: (2.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid 2.0 KHOP_DYNAMIC Relay looks like a dynamic address X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.4 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: (Final attempt at sending, TLS was being enforced for my outgoing emails, sorry Alan for the spam!) Hi Alan, On 24 Sep 2018, at 11:17, Alan Third wrote: [...] Content analysis details: (1.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid 2.0 KHOP_DYNAMIC Relay looks like a dynamic address -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager (Final attempt at sending, TLS was being enforced for my outgoing emails, sorry Alan for the spam!) Hi Alan, On 24 Sep 2018, at 11:17, Alan Third wrote: > On Sun, Sep 23, 2018 at 04:21:13PM +0100, Zack Piper wrote: >> Hi! >> >> (Replacing my post in #31904 with this since they're separate >> issues(?)) > > Sorry, I somehow missed that previous email. No worries at all! >> I've applied a slightly modified (i.e. updated) version of Alan's >> patch from >> bug #31904 >> (attached) to fix an issue concerning the buffer and mode-line not >> being >> rendered. The patch works great, everything is now rendered. >> >> Now I notice that after 5-10 minutes (or even before), Emacs crashes >> with >> the below: >> >> ``` >> objc[82784]: Invalid or prematurely-freed autorelease pool >> 0x1030032e0. >> ``` >> >> This started occurring since upgrading to macOS Mojave, so possibly >> there's >> a bug with Mojave or just some incompatibility, not really sure! > > It’s a bit strange looking, and autorelease pools are something of a > mystery to me. > > I have a suspicion, though, that just creating a new autorelease pool > may solve this. I’ve attached a patch. It’s for emacs-26, but > should > apply OK to master, or without too much work anyway. > > It simply wraps the call to displayIfNeeded in a new pool: > > static void > ns_flush_display (struct frame *f) > /* Force the frame to redisplay. If areas have previously been marked > dirty by setNeedsDisplayInRect (in ns_focus), then this will call > draw_rect: which will "expose" those areas. */ > { > NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; > [FRAME_NS_VIEW (f) displayIfNeeded]; > [pool release]; > } > > Thanks for testing the patch and raising this issue. There’s not > been > a lot of feedback so far and I think we’re going to have to commit > the > patch soon given that Mojave is out today. You're very welcome, and thanks for providing the additional patch! (Later email): > This patch doesn’t help, I finally reproduced the crash with it in > place. Oh, damn. I truly wish I could help somewhat, if you need anything additional from me let me know. I've never really meddled Objective C before, so I'd likely not be able to help much. Obviously I'm more than happy to test any patches you throw at me! :-) I did look at the autorelease pool thing and tried to see where it would fit in, to no avail. Let me know if you need anything. > -- > Alan Third Thanks, Zack From unknown Sat Jun 21 03:30:02 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32812: 27.0.50; macOS Mojave GNU Emacs crash after 5-10 minutes or so Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Sep 2018 13:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32812 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Zack Piper Cc: 32812@debbugs.gnu.org Received: via spool by 32812-submit@debbugs.gnu.org id=B32812.153779470518433 (code B ref 32812); Mon, 24 Sep 2018 13:12:01 +0000 Received: (at 32812) by debbugs.gnu.org; 24 Sep 2018 13:11:45 +0000 Received: from localhost ([127.0.0.1]:51482 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4QeO-0004nF-WC for submit@debbugs.gnu.org; Mon, 24 Sep 2018 09:11:45 -0400 Received: from mail-wr1-f48.google.com ([209.85.221.48]:39002) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4QeN-0004n0-60 for 32812@debbugs.gnu.org; Mon, 24 Sep 2018 09:11:43 -0400 Received: by mail-wr1-f48.google.com with SMTP id s14-v6so19611993wrw.6 for <32812@debbugs.gnu.org>; Mon, 24 Sep 2018 06:11:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=6MFuwy9VFO1iTp5+qE7ouhn3otT5qzR+sxxgKQaknoc=; b=MXQWBYE7bZ8MyJiIkVEj3YVcZyWdwn9OyY2o0bjowgLo831BcN/hegFdud1olScrek axKjCK9K6oNVB0PR2EgR1S+ccPSB8vmV5Nc2FYoJmjs1lrANCu6jK+2pGVu4kC7M11vk x9Yb0tnoP7tQ1b6MS3gP7R4gvsn+SluzyVx36KVuaPFuKqIylWo/F0XmNqQLieqZrsTl OWRvOoUuZrJmwoT5kC3OULt3FTmWbqJ782YdLDJCRTvq2t3XLh+NfS7CHS7rnGNfN542 2k0IjGmQ18uDCMicBVk0pZ8HHK1AadCey+/9SPHmo7hLV2fqv9UR2w1RMkF8Fsrd0dHp GqkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=6MFuwy9VFO1iTp5+qE7ouhn3otT5qzR+sxxgKQaknoc=; b=HjnHoFaPTJMlMMclSaEMaW7bEXDrS4d5nW+IJdjST4IVK+860WyI8PvVfIzlVHKqWR WvrMyCX77cTAZCx9+nfxcdwOduvVOEyx1W4BpPPMbMytCHCmkoWzRj80JwYSC/6XoWyG LY0dOa0nwUhybWFNzYQ0ha0h1epksngy2G8Q3t1kf4TNKgcMfKMQqPhEyY8kHbfc40AF RerTspTHatmFsv9QOFXKne15zTB79jEuUP2TL1yN/VJBfHW0Q9Hj3SkP9skPB7/GxZBN ou4uPsY3myNlLvsnAoqahE+B4o/JkLU93p3kyL82ZERONjItNWxGkOFoMefMy7ZFcD/K ttjA== X-Gm-Message-State: ABuFfogzZSBjTIebr3gD6/TfD4I2/4JQBULMv7apEUGD1ZmuK/4+y5DV g6v9pa9Smx/tfbo6NXncdE4ZXAkQ X-Google-Smtp-Source: ACcGV63UW9sdSP+VyhhKelnmqslgnR22UnjCusuX1JLwXBU4MYJ2Kyga2G6RraAtW9XQZRsSRx/Abg== X-Received: by 2002:adf:c98d:: with SMTP id f13-v6mr8820640wrh.148.1537794697301; Mon, 24 Sep 2018 06:11:37 -0700 (PDT) Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-dcd3-a1c4-8230-b248.holly.idiocy.org. [2001:8b0:3f8:8129:dcd3:a1c4:8230:b248]) by smtp.gmail.com with ESMTPSA id e64-v6sm6144357wmg.0.2018.09.24.06.11.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Sep 2018 06:11:35 -0700 (PDT) Date: Mon, 24 Sep 2018 14:11:33 +0100 From: Alan Third Message-ID: <20180924131133.GA26922@breton.holly.idiocy.org> References: <8C435A35-6F98-45D4-AF3E-1052E9420212@apertron.com> <20180924101706.GA24015@breton.holly.idiocy.org> <44769E5D-B37C-48AF-9C17-38264CE6224A@apertron.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="fUYQa+Pmc3FrFX/N" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <44769E5D-B37C-48AF-9C17-38264CE6224A@apertron.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Score: 0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) --fUYQa+Pmc3FrFX/N Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Mon, Sep 24, 2018 at 12:39:22PM +0100, Zack Piper wrote: > (Final attempt at sending, TLS was being enforced for my outgoing emails, > sorry Alan for the spam!) I think I actually did receive all the emails. No big deal, though. > > This patch doesn’t help, I finally reproduced the crash with it in > > place. > > Oh, damn. I think I’ve got it this time. I haven’t managed to reproduce the crash, but I may just have been lucky. > I truly wish I could help somewhat, if you need anything additional from me > let me know. That’s OK, just testing the patches is helpful. -- Alan Third --fUYQa+Pmc3FrFX/N Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-Fix-crash-on-flush-to-display-bug-32812.patch" >From 356f20b5d8b5809100102797c51f1b54cc8a908e Mon Sep 17 00:00:00 2001 From: Alan Third Date: Mon, 24 Sep 2018 14:04:54 +0100 Subject: [PATCH] Fix crash on flush to display (bug#32812) * src/nsterm.m (ns_flush_display): Block input to prevent Emacs IO processing inside AppKit code. --- src/nsterm.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/nsterm.m b/src/nsterm.m index b36d847eb3..4c03d35c69 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1252,7 +1252,9 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen) dirty by setNeedsDisplayInRect (in ns_focus), then this will call draw_rect: which will "expose" those areas. */ { + block_input (); [FRAME_NS_VIEW (f) displayIfNeeded]; + unblock_input (); } -- 2.18.0 --fUYQa+Pmc3FrFX/N-- From unknown Sat Jun 21 03:30:02 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32812: 27.0.50; macOS Mojave GNU Emacs crash after 5-10 minutes or so Resent-From: "Zack Piper" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Sep 2018 14:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32812 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: "Alan Third" Cc: 32812@debbugs.gnu.org Received: via spool by 32812-submit@debbugs.gnu.org id=B32812.153779862725355 (code B ref 32812); Mon, 24 Sep 2018 14:18:02 +0000 Received: (at 32812) by debbugs.gnu.org; 24 Sep 2018 14:17:07 +0000 Received: from localhost ([127.0.0.1]:52178 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4Rff-0006at-H0 for submit@debbugs.gnu.org; Mon, 24 Sep 2018 10:17:07 -0400 Received: from 183.ip-51-68-126.eu ([51.68.126.183]:57194 helo=zmail.apertron.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4Rfd-0006ah-2e for 32812@debbugs.gnu.org; Mon, 24 Sep 2018 10:17:05 -0400 Received: from [172.25.55.63] (unknown [213.205.194.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: zack@apertron.com) by zmail.apertron.com (Postfix) with ESMTPSA id B5198607F9; Mon, 24 Sep 2018 14:16:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apertron.com; s=dkim; t=1537798616; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lrBEvBeqPKxZLug0ePgEqgtNxleMxMiy72dS8GwlOfs=; b=DlABVQ2vbzu6w2EY9GIsjOiyQNovpzQlsn+S9qVp+6uGS292ow45KsVxgkFl3NlCvMmpEF xIO+ugER7ZmTtm3JQxkD7k5755d0vlWZMVmWuHmdYldUHu4cP6zNQ/I//oOkL5OkCztmMO Gx9FP/8XXo1HseWZ0GN12MhhTlDOZwI= From: "Zack Piper" Date: Mon, 24 Sep 2018 15:16:59 +0100 Message-ID: In-Reply-To: <20180924131133.GA26922@breton.holly.idiocy.org> References: <8C435A35-6F98-45D4-AF3E-1052E9420212@apertron.com> <20180924101706.GA24015@breton.holly.idiocy.org> <44769E5D-B37C-48AF-9C17-38264CE6224A@apertron.com> <20180924131133.GA26922@breton.holly.idiocy.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; markup=markdown Content-Transfer-Encoding: 8bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=apertron.com; s=dkim; t=1537798616; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lrBEvBeqPKxZLug0ePgEqgtNxleMxMiy72dS8GwlOfs=; b=EQqMJ3+KQU1dxA9zYWbrpRDCSBuOCRkZvZMeR/exw/aQ2UA8+cQMIOPcco2DVmBO3tD7VX vvDXmsW5D7C/Z6c9CvquQBE/MmyWPkuzRrgNejM62dObUF6l/aw4t7ggEwLCeWJsOT7Ec5 OO/QPVDJs6I082zUvrymXt4FZpK0aCg= ARC-Seal: i=1; s=dkim; d=apertron.com; t=1537798616; a=rsa-sha256; cv=none; b=r4DUdmKv4fR/XGIXgJzBy+BrYPc+L+E/QB0Mt7A8d5uVWoMBTPd+eVVcRXeIpYR941pdZU/RTwu+eu++THllxSp9glXq6D0Vg4YyetlpzLjqkf3VpM74UsPvrjxml3+7C3qqFGhdMkOsaKY4u27MdS59mgfCJxHwIecrwmFXrSo= ARC-Authentication-Results: i=1; zmail.apertron.com; auth=pass smtp.auth=zack@apertron.com smtp.mailfrom=zack@apertron.com X-Spam-Score: 2.4 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi Alan, On 24 Sep 2018, at 14:11, Alan Third wrote: > On Mon, Sep 24, 2018 at 12:39:22PM +0100, Zack Piper wrote: >> (Final attempt at sending, TLS was being enforced for my outgoing >> emails, >> sorry Alan for the spam!) > > I think I actually did receive all the emails. No big deal, though. > [...] Content analysis details: (2.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid 2.0 KHOP_DYNAMIC Relay looks like a dynamic address X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.4 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi Alan, On 24 Sep 2018, at 14:11, Alan Third wrote: > On Mon, Sep 24, 2018 at 12:39:22PM +0100, Zack Piper wrote: >> (Final attempt at sending, TLS was being enforced for my outgoing >> emails, >> sorry Alan for the spam!) > > I think I actually did receive all the emails. No big deal, though. > [...] Content analysis details: (1.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid 2.0 KHOP_DYNAMIC Relay looks like a dynamic address -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager Hi Alan, On 24 Sep 2018, at 14:11, Alan Third wrote: > On Mon, Sep 24, 2018 at 12:39:22PM +0100, Zack Piper wrote: >> (Final attempt at sending, TLS was being enforced for my outgoing >> emails, >> sorry Alan for the spam!) > > I think I actually did receive all the emails. No big deal, though. > I forgot to take you out of the CC when trying to get the email to go to debbugs Seems debbugs.gnu.org SMTP doesn't offer TLS, according to my mail server at least. I just disabled the setting to strictly enforce TLS outbound. >>> This patch doesn’t help, I finally reproduced the crash with it in >>> place. >> >> Oh, damn. > > I think I’ve got it this time. I haven’t managed to reproduce the > crash, but I may just have been lucky. > It's been an hour of use and it hasn't crashed. I can't thank you enough! >> I truly wish I could help somewhat, if you need anything additional >> from me >> let me know. > > That’s OK, just testing the patches is helpful. > > -- > Alan Third Thanks, Zack From unknown Sat Jun 21 03:30:02 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: "Zack Piper" Subject: bug#32812: closed (Re: bug#32812: 27.0.50; macOS Mojave GNU Emacs crash after 5-10 minutes or so) Message-ID: References: <8C435A35-6F98-45D4-AF3E-1052E9420212@apertron.com> X-Gnu-PR-Message: they-closed 32812 X-Gnu-PR-Package: emacs Reply-To: 32812@debbugs.gnu.org Date: Fri, 30 Nov 2018 10:18:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1543573082-10726-1" This is a multi-part message in MIME format... ------------=_1543573082-10726-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #32812: 27.0.50; macOS Mojave GNU Emacs crash after 5-10 minutes or so which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 32812@debbugs.gnu.org. --=20 32812: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D32812 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1543573082-10726-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 32812-done) by debbugs.gnu.org; 30 Nov 2018 10:17:20 +0000 Received: from localhost ([127.0.0.1]:55546 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gSfrL-0002m0-M3 for submit@debbugs.gnu.org; Fri, 30 Nov 2018 05:17:19 -0500 Received: from mail-wm1-f52.google.com ([209.85.128.52]:53127) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gSfrJ-0002ll-TH for 32812-done@debbugs.gnu.org; Fri, 30 Nov 2018 05:17:18 -0500 Received: by mail-wm1-f52.google.com with SMTP id r11-v6so5179445wmb.2 for <32812-done@debbugs.gnu.org>; Fri, 30 Nov 2018 02:17:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=2V+3SDc90ABGE02XZy0jTRjUY66nndC6oA8YOa2ioyc=; b=bKE1kfvewK4kszdiEROBUvFNBOHEdIErnt0BbDLHm160NMNsU1wUMdXEv5rTPUxyjQ qlwzFHShKpRwkmCKJ+iN3mTCb6laKQDPV84W8ETKBbft4SRgjRb2iHMbdr8pSA5ol4Up inYMxlXeDNArmLx7leMrlqgYRaxAvQhun9f/z0z+MSkgX/roDa4Ck9AkxaSaEz99CCb7 PXBIQEhod8zwQBrrFB4FLyvuhw9gtd+s9xwzm9UW6Jvw5Mg9eI52oTH/0q3eyW5Fwya2 oAKbRKkU+EJRZDdxpOh/iqZPYOnGOOaQmO21Qo4pueGBDamh6RNIrQKUVTZWLuCOg/v4 1kqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version :content-transfer-encoding; bh=2V+3SDc90ABGE02XZy0jTRjUY66nndC6oA8YOa2ioyc=; b=skQXKF2nDM0yxs7nuXQ3olF0u7ihSBHjRPBfG3vHDYIToEI9aqeOeclZu1pFyNAsCp odNQeIM3VHHT6uOOsSJxoFQEe2lGlA4yQMu1e727EpealPDVE32DXFA4NFH1KXN77uyO EZjhEbatTxkr3QKUz3+tzHvkDxAqPnL6qUGJywXJ3dBKDFdXuHC85gokxRMY0pZ+Ag+C +qMQ/cuCfQ+tEung1OA1ubGz6ZBv5UigAj9PEULejb1eg9WBtniOmJjqiFGgAHZNEStH 8a/yamJyvqqGsG/hRq97kkY0oVsl1SvQCj3cj3MWV75JmD/w1kd3F3ntmv0vi/zzhNhG zo3g== X-Gm-Message-State: AA+aEWZDIEATvFnycEdaJDsqCSrBswQ6jpA5iQGDooo4v9JVJZx4c9c4 bBZ2UwbvVtvBU2SEkm69dSzkcajH X-Google-Smtp-Source: AFSGD/UF6xP9Qt/bKtfyi4FOEPwljY18uDuovAVAJNtT+xJkqMRlWsQKXHdJ5VhvA5GcpRFl0Nmyow== X-Received: by 2002:a1c:8548:: with SMTP id h69mr4693323wmd.11.1543573031580; Fri, 30 Nov 2018 02:17:11 -0800 (PST) Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-5d77-74ac-6cf9-3453.holly.idiocy.org. [2001:8b0:3f8:8129:5d77:74ac:6cf9:3453]) by smtp.gmail.com with ESMTPSA id y8sm3944318wmg.13.2018.11.30.02.17.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 02:17:10 -0800 (PST) From: Alan Third To: Zack Piper Subject: Re: bug#32812: 27.0.50; macOS Mojave GNU Emacs crash after 5-10 minutes or so References: <8C435A35-6F98-45D4-AF3E-1052E9420212@apertron.com> <20180924101706.GA24015@breton.holly.idiocy.org> <44769E5D-B37C-48AF-9C17-38264CE6224A@apertron.com> <20180924131133.GA26922@breton.holly.idiocy.org> Date: Fri, 30 Nov 2018 10:17:02 +0000 In-Reply-To: <20180924131133.GA26922@breton.holly.idiocy.org> (Alan Third's message of "Mon, 24 Sep 2018 14:11:33 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (darwin) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 32812-done Cc: 32812-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) Alan Third writes: > On Mon, Sep 24, 2018 at 12:39:22PM +0100, Zack Piper wrote: >> (Final attempt at sending, TLS was being enforced for my outgoing emails, >> sorry Alan for the spam!) > > I think I actually did receive all the emails. No big deal, though. > >> > This patch doesn=E2=80=99t help, I finally reproduced the crash with i= t in >> > place. >>=20 >> Oh, damn. > > I think I=E2=80=99ve got it this time. I haven=E2=80=99t managed to repro= duce the > crash, but I may just have been lucky. > >> I truly wish I could help somewhat, if you need anything additional from= me >> let me know. > > That=E2=80=99s OK, just testing the patches is helpful. The code that was causing this crash has been completely removed now, so I'm closing this bug report. --=20 Alan Third ------------=_1543573082-10726-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 23 Sep 2018 17:09:19 +0000 Received: from localhost ([127.0.0.1]:51036 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g47sj-00073B-2I for submit@debbugs.gnu.org; Sun, 23 Sep 2018 13:09:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56904) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g46Nc-0004mU-7B for submit@debbugs.gnu.org; Sun, 23 Sep 2018 11:33:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g46NO-0006DB-1w for submit@debbugs.gnu.org; Sun, 23 Sep 2018 11:32:57 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,HTML_MESSAGE, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:59440) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g46NH-00068t-5m for submit@debbugs.gnu.org; Sun, 23 Sep 2018 11:32:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38162) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g46NA-0000aw-Fr for bug-gnu-emacs@gnu.org; Sun, 23 Sep 2018 11:32:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g46N1-0005yB-43 for bug-gnu-emacs@gnu.org; Sun, 23 Sep 2018 11:32:34 -0400 Received: from 183.ip-51-68-126.eu ([51.68.126.183]:52000 helo=zmail.apertron.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g46LU-0004qE-7u for bug-gnu-emacs@gnu.org; Sun, 23 Sep 2018 11:32:22 -0400 Received: from [10.37.129.2] (host-92-11-100-92.as43234.net [92.11.100.92]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: zack@apertron.com) by zmail.apertron.com (Postfix) with ESMTPSA id 5428A60A04 for ; Sun, 23 Sep 2018 15:21:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apertron.com; s=dkim; t=1537716070; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references; bh=waEk0x2EDZdJfVTv2onUtW5stBiFEhrF9Xag8txhdyA=; b=LDBzCT5Yc7ipra1eqi+ThcBK57zyhlDk5cEDkzNn3+aVSt+A66EYaTkz5XcI+eg/5AgLxR au52tgkbw7mL4Xki7+YqI89U+AbNH9ZKStUrtBdQW6uHk5pmQMo/blvfJHnvJoRscCdUfd 0aqEjO5K64/UUj+AtmiQm6r7T49kkqc= From: "Zack Piper" To: bug-gnu-emacs@gnu.org Subject: 27.0.50; macOS Mojave GNU Emacs crash after 5-10 minutes or so Date: Sun, 23 Sep 2018 16:21:13 +0100 Message-ID: <8C435A35-6F98-45D4-AF3E-1052E9420212@apertron.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_MailMate_15D6F859-CEB5-4223-ACEC-B3386C3809D5_=" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=apertron.com; s=dkim; t=1537716070; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references; bh=waEk0x2EDZdJfVTv2onUtW5stBiFEhrF9Xag8txhdyA=; b=eyv5DGyDjbT3er4q+XZTMMW77zxWTR7oN8Glub9N7aHFZ+Jv4ROZBYtVDVLjunxGw5WMBe Tws+9w9/buS4qHa4r9bcSGjAGg0u4DYF17SYXB+prCkhWY7VSqYwzlzMyqJRkGifxrQqfm Z46qIOW06hJv/V7EgTUoIJqFhFTQUxI= ARC-Seal: i=1; s=dkim; d=apertron.com; t=1537716070; a=rsa-sha256; cv=none; b=N8O1ESpodrEKDHqlpZRIpW7mVJtKs/2uk3XOOFhr+Olysp+2IJjB9ggorXunPumy17JlFXDwC+S1+Cwxl/FiXk/jwbbg9bexLAks3ECHDMEj1xsVNW7amu9Pb9sIR10A1cGTPijUKB6Z54mKkk4BKaAHSSarvf4tV2I4fIuTmAI= ARC-Authentication-Results: i=1; zmail.apertron.com; auth=pass smtp.auth=zack@apertron.com smtp.mailfrom=zack@apertron.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sun, 23 Sep 2018 13:09:16 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --=_MailMate_15D6F859-CEB5-4223-ACEC-B3386C3809D5_= Content-Type: multipart/alternative; boundary="=_MailMate_65DE84D5-2086-498F-86F7-68B534D7F788_=" --=_MailMate_65DE84D5-2086-498F-86F7-68B534D7F788_= Content-Type: text/plain; format=flowed; markup=markdown Content-Transfer-Encoding: quoted-printable Hi! (Replacing my post in #31904 with this since they're separate issues(?)) I've applied a slightly modified (i.e. updated) version of Alan's patch = from bug #31904 (attached) to fix an issue concerning the buffer and mode-line not being = rendered. The patch works great, everything is now rendered. Now I notice that after 5-10 minutes (or even before), Emacs crashes = with the below: ``` objc[82784]: Invalid or prematurely-freed autorelease pool 0x1030032e0. ``` This started occurring since upgrading to macOS Mojave, so possibly = there's a bug with Mojave or just some incompatibility, not really sure! (I'm hoping I got it compiled with the appropriate parameters for = debugging) The crash isn't intermittent, just takes a variable amount of time to = trigger. It can trigger regardless of me using Emacs (i.e. typing) or not. Also worthy to note this happens with the original patch applied to the = emacs-26 branch. Below is a backtrace of the issue: ``` objc[95306]: Invalid or prematurely-freed autorelease pool 0x103e60378. Process 95306 stopped * thread #1, queue =3D 'com.apple.main-thread', stop reason =3D signal = SIGABRT frame #0: 0x00007fff7679b01e = libsystem_kernel.dylib`__abort_with_payload + 10 libsystem_kernel.dylib`__abort_with_payload: -> 0x7fff7679b01e <+10>: jae 0x7fff7679b028 ; <+20> 0x7fff7679b020 <+12>: movq %rax, %rdi 0x7fff7679b023 <+15>: jmp 0x7fff7677de67 ; = cerror_nocancel 0x7fff7679b028 <+20>: retq Target 0: (Emacs) stopped. (lldb) bt all * thread #1, queue =3D 'com.apple.main-thread', stop reason =3D signal = SIGABRT * frame #0: 0x00007fff7679b01e = libsystem_kernel.dylib`__abort_with_payload + 10 frame #1: 0x00007fff76796561 = libsystem_kernel.dylib`abort_with_payload_wrapper_internal + 82 frame #2: 0x00007fff7679650f = libsystem_kernel.dylib`abort_with_reason + 22 frame #3: 0x00007fff75579674 libobjc.A.dylib`_objc_fatalv(unsigned = long long, unsigned long long, char const*, __va_list_tag*) + 108 frame #4: 0x00007fff75579526 libobjc.A.dylib`_objc_fatal(char = const*, ...) + 135 frame #5: 0x00007fff7556bd73 libobjc.A.dylib`(anonymous = namespace)::AutoreleasePoolPage::pop(void*) + 957 frame #6: 0x00007fff46c2d232 AppKit`-[NSView(NSInternal) = _recursive:displayRectIgnoringOpacity:inContext:shouldChangeFontReference= Color:stopAtLayerBackedViews:] = + 3454 frame #7: 0x00007fff46c2c4a2 AppKit`__46-[NSView(NSLayerKitGlue) = drawLayer:inContext:]_block_invoke + 192 frame #8: 0x00007fff46c2c201 AppKit`-[NSView(NSLayerKitGlue) = _drawViewBackingLayer:inContext:drawingHandler:] + 1769 frame #9: 0x00007fff54540aaf QuartzCore`CABackingStoreUpdate_ + 577 frame #10: 0x00007fff545a2325 = QuartzCore`___ZN2CA5Layer8display_Ev_block_invoke + 53 frame #11: 0x00007fff5453fc90 QuartzCore`-[CALayer _display] + 1839 frame #12: 0x00007fff46c2b75a AppKit`_NSBackingLayerDisplay + 531 frame #13: 0x00007fff46c0fcc9 AppKit`-[_NSViewBackingLayer display] = + 811 frame #14: 0x00007fff46c0f949 AppKit`_NSBackingLayerDisplayIfNeeded = + 40 frame #15: 0x00007fff46c0f2a4 AppKit`-[NSView displayIfNeeded] + = 130 frame #16: 0x0000000100026514 Emacs`echo_area_display + 593 frame #17: 0x00000001000261ca Emacs`message3_nolog + 393 frame #18: 0x0000000100025fe3 Emacs`message3 + 399 frame #19: 0x0000000100106a03 Emacs`Fmessage + 67 frame #20: 0x000000010010f525 Emacs`Ffuncall + 665 frame #21: 0x0000000100145e02 Emacs`exec_byte_code + 1486 frame #22: 0x0000000100110040 Emacs`funcall_lambda + 648 frame #23: 0x000000010010f4c2 Emacs`Ffuncall + 566 frame #24: 0x000000010010f704 Emacs`funcall_nil + 9 frame #25: 0x000000010010f6a0 Emacs`run_hook_with_args + 198 frame #26: 0x000000010010f58b Emacs`Frun_hooks + 60 frame #27: 0x000000010010f525 Emacs`Ffuncall + 665 frame #28: 0x0000000100145e02 Emacs`exec_byte_code + 1486 frame #29: 0x000000010010f4c2 Emacs`Ffuncall + 566 frame #30: 0x0000000100145e02 Emacs`exec_byte_code + 1486 frame #31: 0x000000010010f4c2 Emacs`Ffuncall + 566 frame #32: 0x0000000100145e02 Emacs`exec_byte_code + 1486 frame #33: 0x000000010010f4c2 Emacs`Ffuncall + 566 frame #34: 0x0000000100145e02 Emacs`exec_byte_code + 1486 frame #35: 0x000000010010f4c2 Emacs`Ffuncall + 566 frame #36: 0x0000000100145e02 Emacs`exec_byte_code + 1486 frame #37: 0x000000010010f4c2 Emacs`Ffuncall + 566 frame #38: 0x0000000100145e02 Emacs`exec_byte_code + 1486 frame #39: 0x000000010010ee62 Emacs`apply_lambda + 369 frame #40: 0x000000010010c484 Emacs`eval_sub + 845 frame #41: 0x000000010012d294 Emacs`readevalloop + 1773 frame #42: 0x000000010012d502 Emacs`Feval_buffer + 368 frame #43: 0x000000010010fcfe Emacs`funcall_subr + 367 frame #44: 0x000000010010f525 Emacs`Ffuncall + 665 frame #45: 0x0000000100145e02 Emacs`exec_byte_code + 1486 frame #46: 0x0000000100110040 Emacs`funcall_lambda + 648 frame #47: 0x000000010010f4c2 Emacs`Ffuncall + 566 frame #48: 0x000000010010f9d1 Emacs`call4 + 58 frame #49: 0x000000010012b845 Emacs`Fload + 1373 frame #50: 0x000000010010fcfe Emacs`funcall_subr + 367 frame #51: 0x000000010010f525 Emacs`Ffuncall + 665 frame #52: 0x0000000100145e02 Emacs`exec_byte_code + 1486 frame #53: 0x000000010010f4c2 Emacs`Ffuncall + 566 frame #54: 0x0000000100145e02 Emacs`exec_byte_code + 1486 frame #55: 0x000000010010f4c2 Emacs`Ffuncall + 566 frame #56: 0x0000000100145e02 Emacs`exec_byte_code + 1486 frame #57: 0x000000010010ee62 Emacs`apply_lambda + 369 frame #58: 0x000000010010c484 Emacs`eval_sub + 845 frame #59: 0x000000010010ec69 Emacs`Feval + 96 frame #60: 0x000000010010dffd Emacs`internal_condition_case + 87 frame #61: 0x00000001000b17be Emacs`top_level_1 + 45 frame #62: 0x000000010010db85 Emacs`internal_catch + 74 frame #63: 0x00000001000a4a90 Emacs`command_loop + 141 frame #64: 0x00000001000a49c1 Emacs`recursive_edit_1 + 115 frame #65: 0x00000001000a4bdd Emacs`Frecursive_edit + 226 frame #66: 0x00000001000a3aa9 Emacs`main + 5211 frame #67: 0x00007fff76645085 libdyld.dylib`start + 1 frame #68: 0x00007fff76645085 libdyld.dylib`start + 1 thread #2 frame #0: 0x00007fff7677f5be = libsystem_kernel.dylib`__workq_kernreturn + 10 frame #1: 0x6874656d00000000 frame #2: 0x00007fff76836415 libsystem_pthread.dylib`start_wqthread = + 13 thread #3 frame #0: 0x00007fff7677f5be = libsystem_kernel.dylib`__workq_kernreturn + 10 frame #1: 0x00007fff76836641 = libsystem_pthread.dylib`_pthread_wqthread + 446 frame #2: 0x00007fff76836415 libsystem_pthread.dylib`start_wqthread = + 13 thread #4, name =3D 'gmain' frame #0: 0x00007fff76784e82 libsystem_kernel.dylib`__select + 10 frame #1: 0x0000000100a083da libglib-2.0.0.dylib`g_poll + 405 frame #2: 0x00000001009fc123 = libglib-2.0.0.dylib`g_main_context_iterate + 340 frame #3: 0x00000001009fc1d1 = libglib-2.0.0.dylib`g_main_context_iteration + 55 frame #4: 0x00000001009fd2b0 libglib-2.0.0.dylib`glib_worker_main + = 30 frame #5: 0x0000000100a1dcb7 libglib-2.0.0.dylib`g_thread_proxy + = 90 frame #6: 0x00007fff7683733d libsystem_pthread.dylib`_pthread_body = + 126 frame #7: 0x00007fff7683a2a7 libsystem_pthread.dylib`_pthread_start = + 70 frame #8: 0x00007fff76836425 libsystem_pthread.dylib`thread_start + = 13 thread #5 frame #0: 0x00007fff7677f5be = libsystem_kernel.dylib`__workq_kernreturn + 10 frame #1: 0x00007fff76836721 = libsystem_pthread.dylib`_pthread_wqthread + 670 frame #2: 0x00007fff76836415 libsystem_pthread.dylib`start_wqthread = + 13 thread #7 frame #0: 0x00007fff76784e82 libsystem_kernel.dylib`__select + 10 frame #1: 0x000000010017c408 Emacs`-[EmacsApp fd_handler:] + 214 frame #2: 0x00007fff4b902234 Foundation`__NSThread__start__ + 1218 frame #3: 0x00007fff7683733d libsystem_pthread.dylib`_pthread_body = + 126 frame #4: 0x00007fff7683a2a7 libsystem_pthread.dylib`_pthread_start = + 70 frame #5: 0x00007fff76836425 libsystem_pthread.dylib`thread_start + = 13 thread #9, name =3D 'com.apple.NSEventThread' frame #0: 0x00007fff7677dc2a libsystem_kernel.dylib`mach_msg_trap + = 10 frame #1: 0x00007fff7677e174 libsystem_kernel.dylib`mach_msg + 60 frame #2: 0x00007fff495ad05e = CoreFoundation`__CFRunLoopServiceMachPort + 337 frame #3: 0x00007fff495ac5ad CoreFoundation`__CFRunLoopRun + 1654 frame #4: 0x00007fff495abce4 CoreFoundation`CFRunLoopRunSpecific + = 463 frame #5: 0x00007fff46b0b581 AppKit`_NSEventThread + 160 frame #6: 0x00007fff7683733d libsystem_pthread.dylib`_pthread_body = + 126 frame #7: 0x00007fff7683a2a7 libsystem_pthread.dylib`_pthread_start = + 70 frame #8: 0x00007fff76836425 libsystem_pthread.dylib`thread_start + = 13 (lldb) ``` In GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin18.0.0, NS = appkit-1671.00 Version 10.14 (Build 18A389)) of 2018-09-19 built on zoral Repository revision: 75d9a55fae1c484aa6d213064931bfe3b65cf5dd Windowing system distributor 'Apple', version 10.3.1671 System Description: Mac OS X 10.14 Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Configured using: 'configure --disable-dependency-tracking --disable-silent-rules --enable-locallisppath=3D/usr/local/share/emacs/site-lisp --enable-check-lisp-object-type --infodir=3D/usr/local/Cellar/emacs-plus/HEAD-75d9a55/share/info/emacs --prefix=3D/usr/local/Cellar/emacs-plus/HEAD-75d9a55 --with-xml2 --without-dbus --with-gnutls --with-imagemagick --with-modules --with-rsvg --with-ns --disable-ns-self-contained 'CFLAGS=3D-O0 -g3'' Configured features: RSVG IMAGEMAGICK GLIB NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS LCMS2 GMP Important settings: value of $LANG: en_GB.UTF-8 locale-coding-system: utf-8-unix Major mode: Fundamental Minor modes in effect: tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair time-date tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads kqueue cocoa ns lcms2 multi-tty make-network-process emacs) Memory information: ((conses 16 204840 9831) (symbols 48 20275 1) (strings 32 29150 2191) (string-bytes 1 776518) (vectors 16 35468) (vector-slots 8 735114 19448) (floats 8 46 70) (intervals 56 229 0) (buffers 992 12)) --=_MailMate_65DE84D5-2086-498F-86F7-68B534D7F788_= Content-Type: text/html Content-Transfer-Encoding: quoted-printable

Hi!

(Replacing my post in #31904 with this since they're sepa= rate issues(?))

I've applied a slightly modified (i.e. updated) version o= f Alan's patch from bug #31904
(attached) to fix an issue concerning the buffer and mode-line not being = rendered. The patch works great, everything is now rendered.

Now I notice that after 5-10 minutes (or even before), Em= acs crashes with the below:

objc[82784]: Inva=
lid or prematurely-freed autorelease pool 0x1030032e0.

This started occurring since upgrading to macOS Mojave, s= o possibly there's a bug with Mojave or just some incompatibility, not re= ally sure!

(I'm hoping I got it compiled with the appropriate parame= ters for debugging)

The crash isn't intermittent, just takes a variable amoun= t of time to trigger. It
can trigger regardless of me using Emacs (i.e. typing) or not.

Also worthy to note this happens with the original patch = applied to the emacs-26 branch.

Below is a backtrace of the issue:

objc[95306]: Inva=
lid or prematurely-freed autorelease pool 0x103e60378.
Process 95306 stopped
* thread #1, queue =3D 'com.apple.main-thread', stop reason =3D signal SI=
GABRT
    frame #0: 0x00007fff7679b01e libsystem_kernel.dylib`__abort_with_payl=
oad + 10
libsystem_kernel.dylib`__abort_with_payload:
->  0x7fff7679b01e <+10>: jae    0x7fff7679b028            ; <=
;+20>
    0x7fff7679b020 <+12>: movq   %rax, %rdi
    0x7fff7679b023 <+15>: jmp    0x7fff7677de67            ; cerror=
_nocancel
    0x7fff7679b028 <+20>: retq
Target 0: (Emacs) stopped.
(lldb) bt all
* thread #1, queue =3D 'com.apple.main-thread', stop reason =3D signal SI=
GABRT
  * frame #0: 0x00007fff7679b01e libsystem_kernel.dylib`__abort_with_payl=
oad + 10
    frame #1: 0x00007fff76796561 libsystem_kernel.dylib`abort_with_payloa=
d_wrapper_internal + 82
    frame #2: 0x00007fff7679650f libsystem_kernel.dylib`abort_with_reason=
 + 22
    frame #3: 0x00007fff75579674 libobjc.A.dylib`_objc_fatalv(unsigned lo=
ng long, unsigned long long, char const*, __va_list_tag*) + 108
    frame #4: 0x00007fff75579526 libobjc.A.dylib`_objc_fatal(char const*,=
 ...) + 135
    frame #5: 0x00007fff7556bd73 libobjc.A.dylib`(anonymous namespace)::A=
utoreleasePoolPage::pop(void*) + 957
    frame #6: 0x00007fff46c2d232 AppKit`-[NSView(NSInternal) _recursive:d=
isplayRectIgnoringOpacity:inContext:shouldChangeFontReferenceColor:stopAt=
LayerBackedViews:] + 3454
    frame #7: 0x00007fff46c2c4a2 AppKit`__46-[NSView(NSLayerKitGlue) draw=
Layer:inContext:]_block_invoke + 192
    frame #8: 0x00007fff46c2c201 AppKit`-[NSView(NSLayerKitGlue) _drawVie=
wBackingLayer:inContext:drawingHandler:] + 1769
    frame #9: 0x00007fff54540aaf QuartzCore`CABackingStoreUpdate_ + 577
    frame #10: 0x00007fff545a2325 QuartzCore`___ZN2CA5Layer8display_Ev_bl=
ock_invoke + 53
    frame #11: 0x00007fff5453fc90 QuartzCore`-[CALayer _display] + 1839
    frame #12: 0x00007fff46c2b75a AppKit`_NSBackingLayerDisplay + 531
    frame #13: 0x00007fff46c0fcc9 AppKit`-[_NSViewBackingLayer display] +=
 811
    frame #14: 0x00007fff46c0f949 AppKit`_NSBackingLayerDisplayIfNeeded +=
 40
    frame #15: 0x00007fff46c0f2a4 AppKit`-[NSView displayIfNeeded] + 130
    frame #16: 0x0000000100026514 Emacs`echo_area_display + 593
    frame #17: 0x00000001000261ca Emacs`message3_nolog + 393
    frame #18: 0x0000000100025fe3 Emacs`message3 + 399
    frame #19: 0x0000000100106a03 Emacs`Fmessage + 67
    frame #20: 0x000000010010f525 Emacs`Ffuncall + 665
    frame #21: 0x0000000100145e02 Emacs`exec_byte_code + 1486
    frame #22: 0x0000000100110040 Emacs`funcall_lambda + 648
    frame #23: 0x000000010010f4c2 Emacs`Ffuncall + 566
    frame #24: 0x000000010010f704 Emacs`funcall_nil + 9
    frame #25: 0x000000010010f6a0 Emacs`run_hook_with_args + 198
    frame #26: 0x000000010010f58b Emacs`Frun_hooks + 60
    frame #27: 0x000000010010f525 Emacs`Ffuncall + 665
    frame #28: 0x0000000100145e02 Emacs`exec_byte_code + 1486
    frame #29: 0x000000010010f4c2 Emacs`Ffuncall + 566
    frame #30: 0x0000000100145e02 Emacs`exec_byte_code + 1486
    frame #31: 0x000000010010f4c2 Emacs`Ffuncall + 566
    frame #32: 0x0000000100145e02 Emacs`exec_byte_code + 1486
    frame #33: 0x000000010010f4c2 Emacs`Ffuncall + 566
    frame #34: 0x0000000100145e02 Emacs`exec_byte_code + 1486
    frame #35: 0x000000010010f4c2 Emacs`Ffuncall + 566
    frame #36: 0x0000000100145e02 Emacs`exec_byte_code + 1486
    frame #37: 0x000000010010f4c2 Emacs`Ffuncall + 566
    frame #38: 0x0000000100145e02 Emacs`exec_byte_code + 1486
    frame #39: 0x000000010010ee62 Emacs`apply_lambda + 369
    frame #40: 0x000000010010c484 Emacs`eval_sub + 845
    frame #41: 0x000000010012d294 Emacs`readevalloop + 1773
    frame #42: 0x000000010012d502 Emacs`Feval_buffer + 368
    frame #43: 0x000000010010fcfe Emacs`funcall_subr + 367
    frame #44: 0x000000010010f525 Emacs`Ffuncall + 665
    frame #45: 0x0000000100145e02 Emacs`exec_byte_code + 1486
    frame #46: 0x0000000100110040 Emacs`funcall_lambda + 648
    frame #47: 0x000000010010f4c2 Emacs`Ffuncall + 566
    frame #48: 0x000000010010f9d1 Emacs`call4 + 58
    frame #49: 0x000000010012b845 Emacs`Fload + 1373
    frame #50: 0x000000010010fcfe Emacs`funcall_subr + 367
    frame #51: 0x000000010010f525 Emacs`Ffuncall + 665
    frame #52: 0x0000000100145e02 Emacs`exec_byte_code + 1486
    frame #53: 0x000000010010f4c2 Emacs`Ffuncall + 566
    frame #54: 0x0000000100145e02 Emacs`exec_byte_code + 1486
    frame #55: 0x000000010010f4c2 Emacs`Ffuncall + 566
    frame #56: 0x0000000100145e02 Emacs`exec_byte_code + 1486
    frame #57: 0x000000010010ee62 Emacs`apply_lambda + 369
    frame #58: 0x000000010010c484 Emacs`eval_sub + 845
    frame #59: 0x000000010010ec69 Emacs`Feval + 96
    frame #60: 0x000000010010dffd Emacs`internal_condition_case + 87
    frame #61: 0x00000001000b17be Emacs`top_level_1 + 45
    frame #62: 0x000000010010db85 Emacs`internal_catch + 74
    frame #63: 0x00000001000a4a90 Emacs`command_loop + 141
    frame #64: 0x00000001000a49c1 Emacs`recursive_edit_1 + 115
    frame #65: 0x00000001000a4bdd Emacs`Frecursive_edit + 226
    frame #66: 0x00000001000a3aa9 Emacs`main + 5211
    frame #67: 0x00007fff76645085 libdyld.dylib`start + 1
    frame #68: 0x00007fff76645085 libdyld.dylib`start + 1
  thread #2
    frame #0: 0x00007fff7677f5be libsystem_kernel.dylib`__workq_kernretur=
n + 10
    frame #1: 0x6874656d00000000
    frame #2: 0x00007fff76836415 libsystem_pthread.dylib`start_wqthread +=
 13
  thread #3
    frame #0: 0x00007fff7677f5be libsystem_kernel.dylib`__workq_kernretur=
n + 10
    frame #1: 0x00007fff76836641 libsystem_pthread.dylib`_pthread_wqthrea=
d + 446
    frame #2: 0x00007fff76836415 libsystem_pthread.dylib`start_wqthread +=
 13
  thread #4, name =3D 'gmain'
    frame #0: 0x00007fff76784e82 libsystem_kernel.dylib`__select + 10
    frame #1: 0x0000000100a083da libglib-2.0.0.dylib`g_poll + 405
    frame #2: 0x00000001009fc123 libglib-2.0.0.dylib`g_main_context_itera=
te + 340
    frame #3: 0x00000001009fc1d1 libglib-2.0.0.dylib`g_main_context_itera=
tion + 55
    frame #4: 0x00000001009fd2b0 libglib-2.0.0.dylib`glib_worker_main + 3=
0
    frame #5: 0x0000000100a1dcb7 libglib-2.0.0.dylib`g_thread_proxy + 90
    frame #6: 0x00007fff7683733d libsystem_pthread.dylib`_pthread_body + =
126
    frame #7: 0x00007fff7683a2a7 libsystem_pthread.dylib`_pthread_start +=
 70
    frame #8: 0x00007fff76836425 libsystem_pthread.dylib`thread_start + 1=
3
  thread #5
    frame #0: 0x00007fff7677f5be libsystem_kernel.dylib`__workq_kernretur=
n + 10
    frame #1: 0x00007fff76836721 libsystem_pthread.dylib`_pthread_wqthrea=
d + 670
    frame #2: 0x00007fff76836415 libsystem_pthread.dylib`start_wqthread +=
 13
  thread #7
    frame #0: 0x00007fff76784e82 libsystem_kernel.dylib`__select + 10
    frame #1: 0x000000010017c408 Emacs`-[EmacsApp fd_handler:] + 214
    frame #2: 0x00007fff4b902234 Foundation`__NSThread__start__ + 1218
    frame #3: 0x00007fff7683733d libsystem_pthread.dylib`_pthread_body + =
126
    frame #4: 0x00007fff7683a2a7 libsystem_pthread.dylib`_pthread_start +=
 70
    frame #5: 0x00007fff76836425 libsystem_pthread.dylib`thread_start + 1=
3
  thread #9, name =3D 'com.apple.NSEventThread'
    frame #0: 0x00007fff7677dc2a libsystem_kernel.dylib`mach_msg_trap + 1=
0
    frame #1: 0x00007fff7677e174 libsystem_kernel.dylib`mach_msg + 60
    frame #2: 0x00007fff495ad05e CoreFoundation`__CFRunLoopServiceMachPor=
t + 337
    frame #3: 0x00007fff495ac5ad CoreFoundation`__CFRunLoopRun + 1654
    frame #4: 0x00007fff495abce4 CoreFoundation`CFRunLoopRunSpecific + 46=
3
    frame #5: 0x00007fff46b0b581 AppKit`_NSEventThread + 160
    frame #6: 0x00007fff7683733d libsystem_pthread.dylib`_pthread_body + =
126
    frame #7: 0x00007fff7683a2a7 libsystem_pthread.dylib`_pthread_start +=
 70
    frame #8: 0x00007fff76836425 libsystem_pthread.dylib`thread_start + 1=
3
(lldb)

In GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin18.0.0,= NS appkit-1671.00 Version 10.14 (Build 18A389))
of 2018-09-19 built on zoral
Repository revision: 75d9a55fae1c484aa6d213064931bfe3b65cf5dd
Windowing system distributor 'Apple', version 10.3.1671
System Description: Mac OS X 10.14

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
'configure --disable-dependency-tracking --disable-silent-rules
--enable-locallisppath=3D/usr/local/share/emacs/site-lisp
--enable-check-lisp-object-type
--infodir=3D/usr/local/Cellar/emacs-plus/HEAD-75d9a55/share/info/emacs --prefix=3D/usr/local/Cellar/emacs-plus/HEAD-75d9a55 --with-xml2
--without-dbus --with-gnutls --with-imagemagick --with-modules
--with-rsvg --with-ns --disable-ns-self-contained 'CFLAGS=3D-O0 -g3''

Configured features:
RSVG IMAGEMAGICK GLIB NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS<= br> NS MODULES THREADS LCMS2 GMP

Important settings:
value of $LANG: en_GB.UTF-8
locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
buffer-read-only: t
line-number-mode: t
transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config gnus-util
rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
= mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair time-date
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core term/tty-colors frame cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads kqueue cocoa ns<= br> lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 204840 9831)
(symbols 48 20275 1)
(strings 32 29150 2191)
(string-bytes 1 776518)
(vectors 16 35468)
(vector-slots 8 735114 19448)
(floats 8 46 70)
(intervals 56 229 0)
(buffers 992 12))

--=_MailMate_65DE84D5-2086-498F-86F7-68B534D7F788_=-- --=_MailMate_15D6F859-CEB5-4223-ACEC-B3386C3809D5_= Content-Disposition: attachment; filename=0001-nsterm.m.patch Content-Transfer-Encoding: quoted-printable =46rom dea03ff92e307456d103f716652ae76987da02f9 Mon Sep 17 00:00:00 2001 From: Zack Piper Date: Tue, 18 Sep 2018 21:42:55 +0100 Subject: [PATCH] nsterm.m --- src/nsterm.m | 735 +++++++++++++++++++++++++-------------------------- 1 file changed, 364 insertions(+), 371 deletions(-) diff --git a/src/nsterm.m b/src/nsterm.m index 961271f2d0..a2117eb027 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -278,8 +278,6 @@ - (NSColor *)colorUsingDefaultColorSpace long context_menu_value =3D 0; = /* display update */ -static struct frame *ns_updating_frame; -static NSView *focus_view =3D NULL; static int ns_window_num =3D 0; #ifdef NS_IMPL_GNUSTEP static NSRect uRect; // TODO: This is dead, remove it? @@ -1109,30 +1107,29 @@ static NSRect constrain_frame_rect(NSRect frameRe= ct, bool isFullscreen) } #endif = - ns_updating_frame =3D f; - [view lockFocus]; - /* drawRect may have been called for say the minibuffer, and then clip= path is for the minibuffer. But the display engine may draw more becaus= e we have set the frame as garbaged. So reset clip path to the whole= view. */ + /* FIXME: I don't think we need to do this. */ #ifdef NS_IMPL_COCOA - { - NSBezierPath *bp; - NSRect r =3D [view frame]; - NSRect cr =3D [[view window] frame]; - /* If a large frame size is set, r may be larger than the window fra= me - before constrained. In that case don't change the clip path, as = we - will clear in to the tool bar and title bar. */ - if (r.size.height - + FRAME_NS_TITLEBAR_HEIGHT (f) - + FRAME_TOOLBAR_HEIGHT (f) <=3D cr.size.height) - { - bp =3D [[NSBezierPath bezierPathWithRect: r] retain]; - [bp setClip]; - [bp release]; - } - } + if ([NSView focusView] =3D=3D FRAME_NS_VIEW (f)) + { + NSBezierPath *bp; + NSRect r =3D [view frame]; + NSRect cr =3D [[view window] frame]; + /* If a large frame size is set, r may be larger than the window f= rame + before constrained. In that case don't change the clip path, a= s we + will clear in to the tool bar and title bar. */ + if (r.size.height + + FRAME_NS_TITLEBAR_HEIGHT (f) + + FRAME_TOOLBAR_HEIGHT (f) <=3D cr.size.height) + { + bp =3D [[NSBezierPath bezierPathWithRect: r] retain]; + [bp setClip]; + [bp release]; + } + } #endif = #ifdef NS_IMPL_GNUSTEP @@ -1218,23 +1215,14 @@ static NSRect constrain_frame_rect(NSRect frameRe= ct, bool isFullscreen) external (RIF) call; for whole frame, called after update_window_end ---------------------------------------------------------------------= ----- */ { - EmacsView *view =3D FRAME_NS_VIEW (f); - NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_update_end"); = /* if (f =3D=3D MOUSE_HL_INFO (f)->mouse_face_mouse_frame) */ MOUSE_HL_INFO (f)->mouse_face_defer =3D 0; - - block_input (); - - [view unlockFocus]; - [[view window] flushWindow]; - - unblock_input (); - ns_updating_frame =3D NULL; } = -static void + +static BOOL ns_focus (struct frame *f, NSRect *r, int n) /* ---------------------------------------------------------------------= ----- Internal: Focus on given frame. During small local updates this is u= sed to @@ -1246,48 +1234,38 @@ static NSRect constrain_frame_rect(NSRect frameRe= ct, bool isFullscreen) ---------------------------------------------------------------------= ----- */ { NSTRACE_WHEN (NSTRACE_GROUP_FOCUS, "ns_focus"); - if (r !=3D NULL) + if (r) { NSTRACE_RECT ("r", *r); - } = - if (f !=3D ns_updating_frame) - { - NSView *view =3D FRAME_NS_VIEW (f); - if (view !=3D focus_view) + if ([NSView focusView] =3D=3D FRAME_NS_VIEW (f)) { - if (focus_view !=3D NULL) - { - [focus_view unlockFocus]; - [[focus_view window] flushWindow]; -/* debug_lock--; */ - } + [[NSGraphicsContext currentContext] saveGraphicsState]; + if (n =3D=3D 2) + NSRectClipList (r, 2); + else + NSRectClip (*r); + gsaved =3D YES; = - if (view) - [view lockFocus]; - focus_view =3D view; -/* if (view) debug_lock++; */ + return YES; } - } - - /* clipping */ - if (r) - { - [[NSGraphicsContext currentContext] saveGraphicsState]; - if (n =3D=3D 2) - NSRectClipList (r, 2); else - NSRectClip (*r); - gsaved =3D YES; + { + NSView *view =3D FRAME_NS_VIEW (f); + int i; + for (i =3D 0 ; i < n ; i++) + [view setNeedsDisplayInRect:r[i]]; + } } + + return NO; } = = static void ns_unfocus (struct frame *f) -/* ---------------------------------------------------------------------= ----- - Internal: Remove focus on given frame - ---------------------------------------------------------------------= ----- */ +/* Internal: Restore the previous graphics state, unsetting any + clipping areas. */ { NSTRACE_WHEN (NSTRACE_GROUP_FOCUS, "ns_unfocus"); = @@ -1297,20 +1275,10 @@ static NSRect constrain_frame_rect(NSRect frameRe= ct, bool isFullscreen) gsaved =3D NO; } = - if (f !=3D ns_updating_frame) - { - if (focus_view !=3D NULL) - { - [focus_view unlockFocus]; - [[focus_view window] flushWindow]; - focus_view =3D NULL; -/* debug_lock--; */ - } - } } = = -static void +static BOOL ns_clip_to_row (struct window *w, struct glyph_row *row, enum glyph_row_area area, BOOL gc) /* ---------------------------------------------------------------------= ----- @@ -1329,7 +1297,17 @@ static NSRect constrain_frame_rect(NSRect frameRec= t, bool isFullscreen) clip_rect.size.width =3D window_width; clip_rect.size.height =3D row->visible_height; = - ns_focus (f, &clip_rect, 1); + return ns_focus (f, &clip_rect, 1); +} + + +static void +ns_flush_display (struct frame *f) +/* Force the frame to redisplay. If areas have previously been marked + dirty by setNeedsDisplayInRect (in ns_focus), then this will call + draw_rect: which will "expose" those areas. */ +{ + [FRAME_NS_VIEW (f) displayIfNeeded]; } = = @@ -2826,14 +2804,16 @@ so some key presses (TAB) are swallowed by the sy= stem. */ r =3D [view bounds]; = block_input (); - ns_focus (f, &r, 1); - [ns_lookup_indexed_color (NS_FACE_BACKGROUND - (FACE_FROM_ID (f, DEFAULT_FACE_ID)), f) set]; - NSRectFill (r); - ns_unfocus (f); - - /* as of 2006/11 or so this is now needed */ - ns_redraw_scroll_bars (f); + if (ns_focus (f, &r, 1)) + { + [ns_lookup_indexed_color (NS_FACE_BACKGROUND + (FACE_FROM_ID (f, DEFAULT_FACE_ID)), f) = set]; + NSRectFill (r); + ns_unfocus (f); + + /* as of 2006/11 or so this is now needed */ + ns_redraw_scroll_bars (f); + } unblock_input (); } = @@ -2854,13 +2834,14 @@ so some key presses (TAB) are swallowed by the sy= stem. */ NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_clear_frame_area"); = r =3D NSIntersectionRect (r, [view frame]); - ns_focus (f, &r, 1); - [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set]; + if (ns_focus (f, &r, 1)) + { + [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set]; = - NSRectFill (r); + NSRectFill (r); = - ns_unfocus (f); - return; + ns_unfocus (f); + } } = static void @@ -2872,11 +2853,11 @@ so some key presses (TAB) are swallowed by the sy= stem. */ { hide_bell(); // Ensure the bell image isn't scrolled.= = - ns_focus (f, &dest, 1); + /* FIXME: scrollRect:by: is deprecated in macOS 10.14. There is + no obvious replacement so we may have to come up with our own. = */ [FRAME_NS_VIEW (f) scrollRect: src by: NSMakeSize (dest.origin.x - src.ori= gin.x, dest.origin.y - src.ori= gin.y)]; - ns_unfocus (f); } } = @@ -3087,88 +3068,87 @@ so some key presses (TAB) are swallowed by the sy= stem. */ } = /* Must clip because of partially visible lines. */ - ns_clip_to_row (w, row, ANY_AREA, YES); - - if (!p->overlay_p) + if (ns_clip_to_row (w, row, ANY_AREA, YES)) { - int bx =3D p->bx, by =3D p->by, nx =3D p->nx, ny =3D p->ny; - - if (bx >=3D 0 && nx > 0) + if (!p->overlay_p) { - NSRect r =3D NSMakeRect (bx, by, nx, ny); - NSRectClip (r); - [ns_lookup_indexed_color (face->background, f) set]; - NSRectFill (r); - } - } - - if (p->which) - { - NSRect r =3D NSMakeRect (p->x, p->y, p->wd, p->h); - EmacsImage *img =3D bimgs[p->which - 1]; + int bx =3D p->bx, by =3D p->by, nx =3D p->nx, ny =3D p->ny; = - if (!img) - { - // Note: For "periodic" images, allocate one EmacsImage for - // the base image, and use it for all dh:s. - unsigned short *bits =3D p->bits; - int full_height =3D p->h + p->dh; - int i; - unsigned char *cbits =3D xmalloc (full_height); - - for (i =3D 0; i < full_height; i++) - cbits[i] =3D bits[i]; - img =3D [[EmacsImage alloc] initFromXBM: cbits width: 8 - height: full_height - fg: 0 bg: 0]; - bimgs[p->which - 1] =3D img; - xfree (cbits); + if (bx >=3D 0 && nx > 0) + { + NSRect r =3D NSMakeRect (bx, by, nx, ny); + NSRectClip (r); + [ns_lookup_indexed_color (face->background, f) set]; + NSRectFill (r); + } } = - NSTRACE_RECT ("r", r); + if (p->which) + { + NSRect r =3D NSMakeRect (p->x, p->y, p->wd, p->h); + EmacsImage *img =3D bimgs[p->which - 1]; = - NSRectClip (r); - /* Since we composite the bitmap instead of just blitting it, we n= eed - to erase the whole background. */ - [ns_lookup_indexed_color(face->background, f) set]; - NSRectFill (r); + if (!img) + { + // Note: For "periodic" images, allocate one EmacsImage fo= r + // the base image, and use it for all dh:s. + unsigned short *bits =3D p->bits; + int full_height =3D p->h + p->dh; + int i; + unsigned char *cbits =3D xmalloc (full_height); + + for (i =3D 0; i < full_height; i++) + cbits[i] =3D bits[i]; + img =3D [[EmacsImage alloc] initFromXBM: cbits width: 8 + height: full_height + fg: 0 bg: 0]; + bimgs[p->which - 1] =3D img; + xfree (cbits); + } = - { - NSColor *bm_color; - if (!p->cursor_p) - bm_color =3D ns_lookup_indexed_color(face->foreground, f); - else if (p->overlay_p) - bm_color =3D ns_lookup_indexed_color(face->background, f); - else - bm_color =3D f->output_data.ns->cursor_color; - [img setXBMColor: bm_color]; - } + NSTRACE_RECT ("r", r); = -#ifdef NS_IMPL_COCOA - // Note: For periodic images, the full image height is "h + hd". - // By using the height h, a suitable part of the image is used. - NSRect fromRect =3D NSMakeRect(0, 0, p->wd, p->h); + NSRectClip (r); + /* Since we composite the bitmap instead of just blitting it, = we need + to erase the whole background. */ + [ns_lookup_indexed_color(face->background, f) set]; + NSRectFill (r); = - NSTRACE_RECT ("fromRect", fromRect); + { + NSColor *bm_color; + if (!p->cursor_p) + bm_color =3D ns_lookup_indexed_color(face->foreground, f);= + else if (p->overlay_p) + bm_color =3D ns_lookup_indexed_color(face->background, f);= + else + bm_color =3D f->output_data.ns->cursor_color; + [img setXBMColor: bm_color]; + } = - [img drawInRect: r - fromRect: fromRect - operation: NSCompositingOperationSourceOver - fraction: 1.0 - respectFlipped: YES - hints: nil]; +#ifdef NS_IMPL_COCOA + // Note: For periodic images, the full image height is "h + hd= ". + // By using the height h, a suitable part of the image is used= =2E + NSRect fromRect =3D NSMakeRect(0, 0, p->wd, p->h); + + NSTRACE_RECT ("fromRect", fromRect); + + [img drawInRect: r + fromRect: fromRect + operation: NSCompositingOperationSourceOver + fraction: 1.0 + respectFlipped: YES + hints: nil]; #else - { - NSPoint pt =3D r.origin; - pt.y +=3D p->h; - [img compositeToPoint: pt operation: NSCompositingOperationSourc= eOver]; - } + { + NSPoint pt =3D r.origin; + pt.y +=3D p->h; + [img compositeToPoint: pt operation: NSCompositingOperationS= ourceOver]; + } #endif + } + ns_unfocus (f); } - ns_unfocus (f); } - - static void ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x, int y, enum text_cursor_kinds cursor_type, @@ -3248,66 +3228,65 @@ Note that CURSOR_WIDTH is meaningful only for (h)= bar cursors. r.size.width =3D w->phys_cursor_width; = /* Prevent the cursor from being drawn outside the text area. */ - ns_clip_to_row (w, glyph_row, TEXT_AREA, NO); /* do ns_focus(f, &r, 1)= ; if remove */ - - - face =3D FACE_FROM_ID_OR_NULL (f, phys_cursor_glyph->face_id); - if (face && NS_FACE_BACKGROUND (face) - =3D=3D ns_index_color (FRAME_CURSOR_COLOR (f), f)) + if (ns_clip_to_row (w, glyph_row, TEXT_AREA, NO)) { - [ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), f) set]; - hollow_color =3D FRAME_CURSOR_COLOR (f); - } - else - [FRAME_CURSOR_COLOR (f) set]; + face =3D FACE_FROM_ID_OR_NULL (f, phys_cursor_glyph->face_id); + if (face && NS_FACE_BACKGROUND (face) + =3D=3D ns_index_color (FRAME_CURSOR_COLOR (f), f)) + { + [ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), f) set]; + hollow_color =3D FRAME_CURSOR_COLOR (f); + } + else + [FRAME_CURSOR_COLOR (f) set]; = #ifdef NS_IMPL_COCOA - /* TODO: This makes drawing of cursor plus that of phys_cursor_glyph - atomic. Cleaner ways of doing this should be investigated. - One way would be to set a global variable DRAWING_CURSOR - when making the call to draw_phys..(), don't focus in that - case, then move the ns_unfocus() here after that call. */ - NSDisableScreenUpdates (); + /* TODO: This makes drawing of cursor plus that of phys_cursor_gly= ph + atomic. Cleaner ways of doing this should be investigated. + One way would be to set a global variable DRAWING_CURSOR + when making the call to draw_phys..(), don't focus in that + case, then move the ns_unfocus() here after that call. */ + NSDisableScreenUpdates (); #endif = - switch (cursor_type) - { - case DEFAULT_CURSOR: - case NO_CURSOR: - break; - case FILLED_BOX_CURSOR: - NSRectFill (r); - break; - case HOLLOW_BOX_CURSOR: - NSRectFill (r); - [hollow_color set]; - NSRectFill (NSInsetRect (r, 1, 1)); - [FRAME_CURSOR_COLOR (f) set]; - break; - case HBAR_CURSOR: - NSRectFill (r); - break; - case BAR_CURSOR: - s =3D r; - /* If the character under cursor is R2L, draw the bar cursor - on the right of its glyph, rather than on the left. */ - cursor_glyph =3D get_phys_cursor_glyph (w); - if ((cursor_glyph->resolved_level & 1) !=3D 0) - s.origin.x +=3D cursor_glyph->pixel_width - s.size.width; - - NSRectFill (s); - break; - } - ns_unfocus (f); + switch (cursor_type) + { + case DEFAULT_CURSOR: + case NO_CURSOR: + break; + case FILLED_BOX_CURSOR: + NSRectFill (r); + break; + case HOLLOW_BOX_CURSOR: + NSRectFill (r); + [hollow_color set]; + NSRectFill (NSInsetRect (r, 1, 1)); + [FRAME_CURSOR_COLOR (f) set]; + break; + case HBAR_CURSOR: + NSRectFill (r); + break; + case BAR_CURSOR: + s =3D r; + /* If the character under cursor is R2L, draw the bar cursor + on the right of its glyph, rather than on the left. */ + cursor_glyph =3D get_phys_cursor_glyph (w); + if ((cursor_glyph->resolved_level & 1) !=3D 0) + s.origin.x +=3D cursor_glyph->pixel_width - s.size.width; + + NSRectFill (s); + break; + } + ns_unfocus (f); = - /* draw the character under the cursor */ - if (cursor_type !=3D NO_CURSOR) - draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR); + /* draw the character under the cursor */ + if (cursor_type !=3D NO_CURSOR) + draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR); = #ifdef NS_IMPL_COCOA - NSEnableScreenUpdates (); + NSEnableScreenUpdates (); #endif - + } } = = @@ -3325,12 +3304,14 @@ Note that CURSOR_WIDTH is meaningful only for (h)= bar cursors. = face =3D FACE_FROM_ID_OR_NULL (f, VERTICAL_BORDER_FACE_ID); = - ns_focus (f, &r, 1); - if (face) - [ns_lookup_indexed_color(face->foreground, f) set]; + if (ns_focus (f, &r, 1)) + { + if (face) + [ns_lookup_indexed_color(face->foreground, f) set]; = - NSRectFill(r); - ns_unfocus (f); + NSRectFill(r); + ns_unfocus (f); + } } = = @@ -3357,39 +3338,40 @@ Note that CURSOR_WIDTH is meaningful only for (h)= bar cursors. = NSTRACE ("ns_draw_window_divider"); = - ns_focus (f, ÷r, 1); - - if ((y1 - y0 > x1 - x0) && (x1 - x0 >=3D 3)) - /* A vertical divider, at least three pixels wide: Draw first and - last pixels differently. */ + if (ns_focus (f, ÷r, 1)) { - [ns_lookup_indexed_color(color_first, f) set]; - NSRectFill(NSMakeRect (x0, y0, 1, y1 - y0)); - [ns_lookup_indexed_color(color, f) set]; - NSRectFill(NSMakeRect (x0 + 1, y0, x1 - x0 - 2, y1 - y0)); - [ns_lookup_indexed_color(color_last, f) set]; - NSRectFill(NSMakeRect (x1 - 1, y0, 1, y1 - y0)); - } - else if ((x1 - x0 > y1 - y0) && (y1 - y0 >=3D 3)) - /* A horizontal divider, at least three pixels high: Draw first and - last pixels differently. */ - { - [ns_lookup_indexed_color(color_first, f) set]; - NSRectFill(NSMakeRect (x0, y0, x1 - x0, 1)); - [ns_lookup_indexed_color(color, f) set]; - NSRectFill(NSMakeRect (x0, y0 + 1, x1 - x0, y1 - y0 - 2)); - [ns_lookup_indexed_color(color_last, f) set]; - NSRectFill(NSMakeRect (x0, y1 - 1, x1 - x0, 1)); - } - else - { - /* In any other case do not draw the first and last pixels - differently. */ - [ns_lookup_indexed_color(color, f) set]; - NSRectFill(divider); - } + if ((y1 - y0 > x1 - x0) && (x1 - x0 >=3D 3)) + /* A vertical divider, at least three pixels wide: Draw first an= d + last pixels differently. */ + { + [ns_lookup_indexed_color(color_first, f) set]; + NSRectFill(NSMakeRect (x0, y0, 1, y1 - y0)); + [ns_lookup_indexed_color(color, f) set]; + NSRectFill(NSMakeRect (x0 + 1, y0, x1 - x0 - 2, y1 - y0)); + [ns_lookup_indexed_color(color_last, f) set]; + NSRectFill(NSMakeRect (x1 - 1, y0, 1, y1 - y0)); + } + else if ((x1 - x0 > y1 - y0) && (y1 - y0 >=3D 3)) + /* A horizontal divider, at least three pixels high: Draw first = and + last pixels differently. */ + { + [ns_lookup_indexed_color(color_first, f) set]; + NSRectFill(NSMakeRect (x0, y0, x1 - x0, 1)); + [ns_lookup_indexed_color(color, f) set]; + NSRectFill(NSMakeRect (x0, y0 + 1, x1 - x0, y1 - y0 - 2)); + [ns_lookup_indexed_color(color_last, f) set]; + NSRectFill(NSMakeRect (x0, y1 - 1, x1 - x0, 1)); + } + else + { + /* In any other case do not draw the first and last pixels + differently. */ + [ns_lookup_indexed_color(color, f) set]; + NSRectFill(divider); + } = - ns_unfocus (f); + ns_unfocus (f); + } } = static void @@ -3988,83 +3970,84 @@ Function modeled after x_draw_glyph_string_box ()= =2E n =3D ns_get_glyph_string_clip_rect (s, r); *r =3D NSMakeRect (s->x, s->y, s->background_width, s->height); = - ns_focus (s->f, r, n); - - if (s->hl =3D=3D DRAW_MOUSE_FACE) - { - face =3D FACE_FROM_ID_OR_NULL (s->f, - MOUSE_HL_INFO (s->f)->mouse_face_face_id); - if (!face) - face =3D FACE_FROM_ID (s->f, MOUSE_FACE_ID); - } - else - face =3D FACE_FROM_ID (s->f, s->first_glyph->face_id); - - bgCol =3D ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f= ); - fgCol =3D ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f= ); - - for (i =3D 0; i < n; ++i) + if (ns_focus (s->f, r, n)) { - if (!s->row->full_width_p) + if (s->hl =3D=3D DRAW_MOUSE_FACE) { - int overrun, leftoverrun; - - /* truncate to avoid overwriting fringe and/or scrollbar *= / - overrun =3D max (0, (s->x + s->background_width) - - (WINDOW_BOX_RIGHT_EDGE_X (s->w) - - WINDOW_RIGHT_FRINGE_WIDTH (s->w))); - r[i].size.width -=3D overrun; - - /* truncate to avoid overwriting to left of the window box */ - leftoverrun =3D (WINDOW_BOX_LEFT_EDGE_X (s->w) - + WINDOW_LEFT_FRINGE_WIDTH (s->w)) - s->x; - - if (leftoverrun > 0) - { - r[i].origin.x +=3D leftoverrun; - r[i].size.width -=3D leftoverrun; - } - - /* XXX: Try to work between problem where a stretch glyph = on - a partially-visible bottom row will clear part of the - modeline, and another where list-buffers headers and si= milar - rows erroneously have visible_height set to 0. Not sur= e - where this is coming from as other terms seem not to sh= ow. */ - r[i].size.height =3D min (s->height, s->row->visible_heigh= t); + face =3D FACE_FROM_ID_OR_NULL (s->f, + MOUSE_HL_INFO (s->f)->mouse_f= ace_face_id); + if (!face) + face =3D FACE_FROM_ID (s->f, MOUSE_FACE_ID); } + else + face =3D FACE_FROM_ID (s->f, s->first_glyph->face_id); = - [bgCol set]; + bgCol =3D ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), = s->f); + fgCol =3D ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), = s->f); = - /* NOTE: under NS this is NOT used to draw cursors, but we mus= t avoid - overwriting cursor (usually when cursor on a tab). */ - if (s->hl =3D=3D DRAW_CURSOR) + for (i =3D 0; i < n; ++i) { - CGFloat x, width; + if (!s->row->full_width_p) + { + int overrun, leftoverrun; + + /* truncate to avoid overwriting fringe and/or scrollb= ar */ + overrun =3D max (0, (s->x + s->background_width) + - (WINDOW_BOX_RIGHT_EDGE_X (s->w) + - WINDOW_RIGHT_FRINGE_WIDTH (s->w)))= ; + r[i].size.width -=3D overrun; + + /* truncate to avoid overwriting to left of the window= box */ + leftoverrun =3D (WINDOW_BOX_LEFT_EDGE_X (s->w) + + WINDOW_LEFT_FRINGE_WIDTH (s->w)) - s-= >x; + + if (leftoverrun > 0) + { + r[i].origin.x +=3D leftoverrun; + r[i].size.width -=3D leftoverrun; + } + + /* XXX: Try to work between problem where a stretch = glyph on + a partially-visible bottom row will clear part of= the + modeline, and another where list-buffers headers = and similar + rows erroneously have visible_height set to 0. N= ot sure + where this is coming from as other terms seem not= to show. */ + r[i].size.height =3D min (s->height, s->row->visible= _height); + } + + [bgCol set]; + + /* NOTE: under NS this is NOT used to draw cursors, but we= must avoid + overwriting cursor (usually when cursor on a tab). */ + if (s->hl =3D=3D DRAW_CURSOR) + { + CGFloat x, width; = - x =3D r[i].origin.x; - width =3D s->w->phys_cursor_width; - r[i].size.width -=3D width; - r[i].origin.x +=3D width; + x =3D r[i].origin.x; + width =3D s->w->phys_cursor_width; + r[i].size.width -=3D width; + r[i].origin.x +=3D width; = - NSRectFill (r[i]); + NSRectFill (r[i]); = - /* Draw overlining, etc. on the cursor. */ - if (s->w->phys_cursor_type =3D=3D FILLED_BOX_CURSOR) - ns_draw_text_decoration (s, face, bgCol, width, x); + /* Draw overlining, etc. on the cursor. */ + if (s->w->phys_cursor_type =3D=3D FILLED_BOX_CURSOR) + ns_draw_text_decoration (s, face, bgCol, width, x); + else + ns_draw_text_decoration (s, face, fgCol, width, x); + } else - ns_draw_text_decoration (s, face, fgCol, width, x); - } - else - { - NSRectFill (r[i]); - } + { + NSRectFill (r[i]); + } = - /* Draw overlining, etc. on the stretch glyph (or the part - of the stretch glyph after the cursor). */ - ns_draw_text_decoration (s, face, fgCol, r[i].size.width, - r[i].origin.x); + /* Draw overlining, etc. on the stretch glyph (or the part= + of the stretch glyph after the cursor). */ + ns_draw_text_decoration (s, face, fgCol, r[i].size.width, + r[i].origin.x); + } + ns_unfocus (s->f); } - ns_unfocus (s->f); s->background_filled_p =3D 1; } } @@ -4214,9 +4197,11 @@ overwriting cursor (usually when cursor on a tab).= */ if (next->first_glyph->type !=3D STRETCH_GLYPH) { n =3D ns_get_glyph_string_clip_rect (s->next, r); - ns_focus (s->f, r, n); - ns_maybe_dumpglyphs_background (s->next, 1); - ns_unfocus (s->f); + if (ns_focus (s->f, r, n)) + { + ns_maybe_dumpglyphs_background (s->next, 1); + ns_unfocus (s->f); + } } else { @@ -4231,10 +4216,12 @@ overwriting cursor (usually when cursor on a tab)= =2E */ || s->first_glyph->type =3D=3D COMPOSITE_GLYPH)) { n =3D ns_get_glyph_string_clip_rect (s, r); - ns_focus (s->f, r, n); - ns_maybe_dumpglyphs_background (s, 1); - ns_dumpglyphs_box_or_relief (s); - ns_unfocus (s->f); + if (ns_focus (s->f, r, n)) + { + ns_maybe_dumpglyphs_background (s, 1); + ns_dumpglyphs_box_or_relief (s); + ns_unfocus (s->f); + } box_drawn_p =3D 1; } = @@ -4243,9 +4230,11 @@ overwriting cursor (usually when cursor on a tab).= */ = case IMAGE_GLYPH: n =3D ns_get_glyph_string_clip_rect (s, r); - ns_focus (s->f, r, n); - ns_dumpglyphs_image (s, r[0]); - ns_unfocus (s->f); + if (ns_focus (s->f, r, n)) + { + ns_dumpglyphs_image (s, r[0]); + ns_unfocus (s->f); + } break; = case STRETCH_GLYPH: @@ -4255,66 +4244,68 @@ overwriting cursor (usually when cursor on a tab)= =2E */ case CHAR_GLYPH: case COMPOSITE_GLYPH: n =3D ns_get_glyph_string_clip_rect (s, r); - ns_focus (s->f, r, n); + if (ns_focus (s->f, r, n)) + { + if (s->for_overlaps || (s->cmp_from > 0 + && ! s->first_glyph->u.cmp.automatic))= + s->background_filled_p =3D 1; + else + ns_maybe_dumpglyphs_background + (s, s->first_glyph->type =3D=3D COMPOSITE_GLYPH); = - if (s->for_overlaps || (s->cmp_from > 0 - && ! s->first_glyph->u.cmp.automatic)) - s->background_filled_p =3D 1; - else - ns_maybe_dumpglyphs_background - (s, s->first_glyph->type =3D=3D COMPOSITE_GLYPH); + if (s->hl =3D=3D DRAW_CURSOR && s->w->phys_cursor_type =3D=3D = FILLED_BOX_CURSOR) + { + unsigned long tmp =3D NS_FACE_BACKGROUND (s->face); + NS_FACE_BACKGROUND (s->face) =3D NS_FACE_FOREGROUND (s->fa= ce); + NS_FACE_FOREGROUND (s->face) =3D tmp; + } = - if (s->hl =3D=3D DRAW_CURSOR && s->w->phys_cursor_type =3D=3D FILL= ED_BOX_CURSOR) - { - unsigned long tmp =3D NS_FACE_BACKGROUND (s->face); - NS_FACE_BACKGROUND (s->face) =3D NS_FACE_FOREGROUND (s->face);= - NS_FACE_FOREGROUND (s->face) =3D tmp; - } + { + BOOL isComposite =3D s->first_glyph->type =3D=3D COMPOSITE_G= LYPH; = - { - BOOL isComposite =3D s->first_glyph->type =3D=3D COMPOSITE_GLYPH= ; + if (isComposite) + ns_draw_composite_glyph_string_foreground (s); + else + ns_draw_glyph_string_foreground (s); + } = - if (isComposite) - ns_draw_composite_glyph_string_foreground (s); - else - ns_draw_glyph_string_foreground (s); - } + { + NSColor *col =3D (NS_FACE_FOREGROUND (s->face) !=3D 0 + ? ns_lookup_indexed_color (NS_FACE_FOREGROUN= D (s->face), + s->f) + : FRAME_FOREGROUND_COLOR (s->f)); + [col set]; + + /* Draw underline, overline, strike-through. */ + ns_draw_text_decoration (s, s->face, col, s->width, s->x); + } = - { - NSColor *col =3D (NS_FACE_FOREGROUND (s->face) !=3D 0 - ? ns_lookup_indexed_color (NS_FACE_FOREGROUND (s= ->face), - s->f) - : FRAME_FOREGROUND_COLOR (s->f)); - [col set]; - - /* Draw underline, overline, strike-through. */ - ns_draw_text_decoration (s, s->face, col, s->width, s->x); - } + if (s->hl =3D=3D DRAW_CURSOR && s->w->phys_cursor_type =3D=3D = FILLED_BOX_CURSOR) + { + unsigned long tmp =3D NS_FACE_BACKGROUND (s->face); + NS_FACE_BACKGROUND (s->face) =3D NS_FACE_FOREGROUND (s->fa= ce); + NS_FACE_FOREGROUND (s->face) =3D tmp; + } = - if (s->hl =3D=3D DRAW_CURSOR && s->w->phys_cursor_type =3D=3D FILL= ED_BOX_CURSOR) - { - unsigned long tmp =3D NS_FACE_BACKGROUND (s->face); - NS_FACE_BACKGROUND (s->face) =3D NS_FACE_FOREGROUND (s->face);= - NS_FACE_FOREGROUND (s->face) =3D tmp; + ns_unfocus (s->f); } - - ns_unfocus (s->f); break; = case GLYPHLESS_GLYPH: n =3D ns_get_glyph_string_clip_rect (s, r); - ns_focus (s->f, r, n); - - if (s->for_overlaps || (s->cmp_from > 0 - && ! s->first_glyph->u.cmp.automatic)) - s->background_filled_p =3D 1; - else - ns_maybe_dumpglyphs_background - (s, s->first_glyph->type =3D=3D COMPOSITE_GLYPH); - /* ... */ - /* Not yet implemented. */ - /* ... */ - ns_unfocus (s->f); + if (ns_focus (s->f, r, n)) + { + if (s->for_overlaps || (s->cmp_from > 0 + && ! s->first_glyph->u.cmp.automatic))= + s->background_filled_p =3D 1; + else + ns_maybe_dumpglyphs_background + (s, s->first_glyph->type =3D=3D COMPOSITE_GLYPH); + /* ... */ + /* Not yet implemented. */ + /* ... */ + ns_unfocus (s->f); + } break; = default: @@ -4325,9 +4316,11 @@ overwriting cursor (usually when cursor on a tab).= */ if (!s->for_overlaps && !box_drawn_p && s->face->box !=3D FACE_NO_BOX)= { n =3D ns_get_glyph_string_clip_rect (s, r); - ns_focus (s->f, r, n); - ns_dumpglyphs_box_or_relief (s); - ns_unfocus (s->f); + if (ns_focus (s->f, r, n)) + { + ns_dumpglyphs_box_or_relief (s); + ns_unfocus (s->f); + } } = s->num_clips =3D 0; @@ -5133,7 +5126,7 @@ static Lisp_Object ns_string_to_lispmod (const char= *s) ns_after_update_window_line, ns_update_window_begin, ns_update_window_end, - 0, /* flush_display */ + ns_flush_display, /* flush_display */ x_clear_window_mouse_face, x_get_glyph_overhangs, x_fix_overlapping_area, -- = 2.19.0 --=_MailMate_15D6F859-CEB5-4223-ACEC-B3386C3809D5_=-- ------------=_1543573082-10726-1--