unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Jindřich Makovička" <makovick@gmail.com>
To: emacs-devel@gnu.org
Subject: [PATCH] src/pgtkselect.c: Avoid Glib assertion warnings
Date: Sun, 30 May 2021 11:47:11 +0200	[thread overview]
Message-ID: <20210530114711.6f145d7d@holly> (raw)

[-- Attachment #1: Type: text/plain, Size: 280 bytes --]

Hi,

when the system clipboard has no owner, PGTK Emacs repeatedly shows
assertion warnings, like

(emacs:8121): GLib-GObject-CRITICAL **: 11:28:16.784:
g_object_get_qdata: assertion 'G_IS_OBJECT (object)' failed

The attached trivial one-liner fixes this.
-- 
Jindrich Makovicka

[-- Attachment #2: 0001-src-pgtkselect.c-Avoid-Glib-assertion-warnings.patch --]
[-- Type: text/x-patch, Size: 877 bytes --]

From db777bd34f1452281963a4db27914a6a31a29549 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jind=C5=99ich=20Makovi=C4=8Dka?= <makovick@gmail.com>
Date: Sun, 30 May 2021 11:40:45 +0200
Subject: [PATCH] * src/pgtkselect.c: Avoid Glib assertion warnings

Do not call g_object_get_qdata, when the clipboard has no owner,
and obj is NULL. Just return Qnil immediately.
---
 src/pgtkselect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pgtkselect.c b/src/pgtkselect.c
index 8ab74744f3..447c839f45 100644
--- a/src/pgtkselect.c
+++ b/src/pgtkselect.c
@@ -518,7 +518,7 @@ DEFUN ("pgtk-selection-owner-p", Fpgtk_selection_owner_p, Spgtk_selection_owner_
 
   obj = gtk_clipboard_get_owner (cb);
 
-  return g_object_get_qdata (obj, quark_data) != NULL ? Qt : Qnil;
+  return obj && g_object_get_qdata (obj, quark_data) != NULL ? Qt : Qnil;
 }
 
 
-- 
2.32.0.rc0


             reply	other threads:[~2021-05-30  9:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-30  9:47 Jindřich Makovička [this message]
2021-06-08 15:48 ` [PATCH] src/pgtkselect.c: Avoid Glib assertion warnings Yuuki Harano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210530114711.6f145d7d@holly \
    --to=makovick@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).