Subject: bug#33294: xwidget-insert crashes Emacs

From: Eli Zaretskii <[email-masked]>
Date: Thu, 08 Nov 2018 16:49:03 +0200

> From: Evgeny Zajcev <[email-masked]>
> Date: Thu, 8 Nov 2018 16:44:05 +0300
> Cc: [email-masked]
> 
> Vanilla emacs (with -Q) crashes as well, here is the backtrace I've got
> with xbacktrace:
> 
> (gdb) run -Q
> Starting program: /usr/local/bin/emacs -Q
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
> [New Thread 0x7fffdb5e0700 (LWP 29299)]
> [New Thread 0x7fffda96e700 (LWP 29300)]
> [New Thread 0x7fffd90f0700 (LWP 29301)]
> [New Thread 0x7fffcbfff700 (LWP 29401)]
> [New Thread 0x7fff8b7fc700 (LWP 29402)]
> [New Thread 0x7fff8affb700 (LWP 29403)]
> [New Thread 0x7fff8a7fa700 (LWP 29404)]
> [New Thread 0x7fff89990700 (LWP 29409)]
> [New Thread 0x7fff8918f700 (LWP 29410)]
> [New Thread 0x7fff8898e700 (LWP 29411)]
> 
> Thread 1 "emacs" hit Breakpoint 1, terminate_due_to_signal (sig=sig@entry=6,
>     backtrace_limit=backtrace_limit@entry=40) at emacs.c:369
> 369     {
> (gdb) bt
> #0  0x00000000004f7d20 in terminate_due_to_signal (sig=sig@entry=6,
> backtrace_limit=backtrace_limit@entry=40) at emacs.c:369
> #1  0x0000000000511a23 in emacs_abort () at sysdep.c:2429
> #2  0x0000000000557487 in Ftype_of (object=<optimized out>) at data.c:278
> .............
> .............
> (gdb) xbacktrace
> [Thread 0x7fff8898e700 (LWP 29411) exited]
> [Thread 0x7fff8918f700 (LWP 29410) exited]
> "type-of" (0xffff8bc8)
> "cl-print-object" (0xffff8e50)
> 0x2e6d9d0 PVEC_COMPILED
> "apply" (0xffff91d8)
> 0x1545ee0 PVEC_COMPILED
> 0x1514fc0 PVEC_COMPILED
> "apply" (0xffff9708)
> 0x150cf50 PVEC_COMPILED
> "apply" (0xffff99f0)
> "cl-print-object" (0xffff9c80)
> 0x2e6d9d0 PVEC_COMPILED
> "apply" (0xffffa008)
> 0x1542f00 PVEC_COMPILED
> 0x1514fc0 PVEC_COMPILED
> "apply" (0xffffa538)
> 0x150cf50 PVEC_COMPILED
> "apply" (0xffffa820)
> "cl-print-object" (0xffffaaa0)
> "cl-prin1" (0xffffacb0)
> "backtrace--print" (0xffffaeb8)
> "cl-print-to-string-with-limit" (0xffffb128)
> "backtrace--print-to-string" (0xffffb398)
> "backtrace--print-func-and-args" (0xffffb700)
> "backtrace-print-frame" (0xffffb940)
> "backtrace-print" (0xffffbbb8)
> "debugger-setup-buffer" (0xffffbf00)
> "debug" (0xffffc2c8)
> "put-text-property" (0xffffc628)

This looks like a problem with cl-prin1, called as part of showing the
Lisp backtrace when put-text-property wants to report an error and
invokes the debugger: can cl-prin1 handle xwidget objects?  Gemini,
could you take a look?  If we want to use cl-prin1 as part of
backtrace display, it must be able to show any object, including
invalid objects.

Or maybe it's a problem with type-of?  What does the following
produce?

  (type-of (make-xwidget 'webkit "*foo*" 320 240))