unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] src/pgtkselect.c: Avoid Glib assertion warnings
@ 2021-05-30  9:47 Jindřich Makovička
  2021-06-08 15:48 ` Yuuki Harano
  0 siblings, 1 reply; 2+ messages in thread
From: Jindřich Makovička @ 2021-05-30  9:47 UTC (permalink / raw)
  To: emacs-devel

[-- 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-08 15:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-30  9:47 [PATCH] src/pgtkselect.c: Avoid Glib assertion warnings Jindřich Makovička
2021-06-08 15:48 ` Yuuki Harano

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).