From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Akira Kyle Newsgroups: gmane.emacs.devel Subject: non-local exits in redisplay Date: Sun, 11 Oct 2020 15:28:26 -0600 Message-ID: <86h7r0v4ed.fsf@akirakyle.com> Mime-Version: 1.0 Content-Type: text/plain; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26559"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.4.13; emacs 28.0.50 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Oct 11 23:36:29 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kRj13-0006pO-IF for ged-emacs-devel@m.gmane-mx.org; Sun, 11 Oct 2020 23:36:29 +0200 Original-Received: from localhost ([::1]:39902 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kRj11-0002tg-4i for ged-emacs-devel@m.gmane-mx.org; Sun, 11 Oct 2020 17:36:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kRitL-0000Nw-FJ for emacs-devel@gnu.org; Sun, 11 Oct 2020 17:28:31 -0400 Original-Received: from mail-il1-f181.google.com ([209.85.166.181]:33756) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kRitJ-0002PF-TB for emacs-devel@gnu.org; Sun, 11 Oct 2020 17:28:31 -0400 Original-Received: by mail-il1-f181.google.com with SMTP id o9so9604533ilo.0 for ; Sun, 11 Oct 2020 14:28:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:user-agent:from:to:subject:date:message-id :mime-version; bh=JFWsVRH9QRAoSRxbIeXbCMxMQKbZRUxG5PozcocUcII=; b=M1HBAvrfykq6VlMuqZ+tduNdX3TpSRTF0CWbV0pa1PZRqKAYaj9hi9NrY+ubAxORAq enYEZcnH3qJh3KzCU/2XzGkjkqvjh/MbI8dVO2+m4wdrcoKDSHDa4ATgw+S+/qJXr6b+ 5GwAwEuAsaaRZ5l2bb4QBWA7hYA4Sq5bZpEDLE0APNjL+l07IDYkbhBFeowIxVMwcJeK wPQmPgmMGuqd5/a/Yuo95sS4/oHIVB0sd+goHB/2Dgh2YqNsr9OJeWCQOHpJXi8R+O3u Rx4gVUB0oloyTtlEZGNQSARXCnMriT4UaVXAnawSxyCgFqkwgtY8IBa9tABspc5Fg2eJ P9LQ== X-Gm-Message-State: AOAM531GqmrTQne6DZCj7PvT5D/ShDMpX+gKTBdtYi7a0TCeAqP4pkgN xWcrpdMatjAwDfC4vI+LO4BBWe4FPL4SYQ== X-Google-Smtp-Source: ABdhPJyfxiCY9SA+d1vvuH5+Jp7n39DaPxSLWmPbmpOzelIBMttPVf1ROuDcNi8cNSeh7M3RpMJQPg== X-Received: by 2002:a92:c507:: with SMTP id r7mr17819192ilg.52.1602451707872; Sun, 11 Oct 2020 14:28:27 -0700 (PDT) Original-Received: from lore ([2601:281:8080:45f0:5849:cbc:11e4:1c0a]) by smtp.gmail.com with ESMTPSA id l77sm8170972ill.4.2020.10.11.14.28.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Oct 2020 14:28:27 -0700 (PDT) Received-SPF: pass client-ip=209.85.166.181; envelope-from=aikokyle@gmail.com; helo=mail-il1-f181.google.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/11 17:28:28 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 11 Oct 2020 17:33:55 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:257418 Archived-At: Hi all, I've been playing around with the xwidget code and I had a question regarding non-local exits from inside redisplay. I've found that if one places code somewhere in redisplay that ends up signaling a lisp error through xsignal, it can often cause an infinite redisplay loop. This seems to be due to xsignal causing a nonlocal exit and the next redisplay will be begin, but unless there's something different, the same code that caused the initial xsignal will execute again and hence the infinte loop. Since I do see code that calls lisp functions inside redisplay I was wondering how one should guard against such non-local exits inside redisplay. As a concrete example, placing a call like CALLN (Ffuncall, Qnil); at the start of xwidget_init_view in xwidget.c will cause redisplay to infinite loop. Note: if you actually try this you'll get a segfault which I think is due to xwidget-webkit-callback executing asynchronously which tries access state that doesn't exist yet because redisplay is infinite looping. To actually see the infinite loop just return Qnil from Fxwidget_webkit_title. Is there a safe way to handle such cases apart from avoiding calling into lisp functions which may non-local exit or manually checking that the arguments you pass will not cause a non-local exit? I'm very new to hacking on Emacs' C source code so it's also entirely possible I missed some bigger concept that makes this actually a silly question :) Akira