Update to 1.68.0

This commit is contained in:
Kalev Lember 2021-03-22 12:25:49 +01:00
parent 540d19c6d0
commit 3867463b89
4 changed files with 12 additions and 85 deletions

1
.gitignore vendored
View File

@ -117,3 +117,4 @@ gjs-0.7.1.tar.gz
/gjs-1.67.1.tar.xz
/gjs-1.67.2.tar.xz
/gjs-1.67.3.tar.xz
/gjs-1.68.0.tar.xz

View File

@ -1,70 +0,0 @@
From c0003eb5ad4c4b0421d723da3d1ff11991f70fb5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Fri, 19 Mar 2021 16:46:42 +0100
Subject: [PATCH] object: Ignore toggle notifications after disposition
As per commit d37d6604 we are not removing a toggle reference on
disposed objects, however it may happen that a disposed object (but not
yet finalized) is still using the toggle references while we're releasing
it, and in such case we must always remove the toggle ref, otherwise
GObject (that doesn't remove toggle notifications on disposition) will
notify us after that the wrapper has been finalized, causing a crash
because at that point the GObject is still very well alive (and so
its qdata) and so when we'll try to get the gjs private data from it,
(namely the JS object wrapper instance) we'll end up accessing freed
memory.
So, on weak notify callback (that we get during disposition, when the
object memory is still valid like its toggle notifications) remove the
toggle reference that we set and consequently toggle down the JSObject
wrapper, unrooting it so that the garbage collector can pick it (this may
also make it a bit more reactive, without waiting for the last reference
being removed if disposition happens as consequence of a run_dispose()
call).
We keep the m_uses_toggle_ref set though to avoid adding another one,
but at this point we also have to check whether the object is also
disposed before considering the toggle ref active, and per this in such
case we've to only release (steal) the m_ptr when releasing the native
object not to access to potentially finalized data.
Fixes: #387
---
gi/object.cpp | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/gi/object.cpp b/gi/object.cpp
index 68410514..598e6bb0 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -1082,10 +1082,18 @@ static void wrapped_gobj_dispose_notify(
where_the_object_was);
}
+static void wrapped_gobj_toggle_notify(void*, GObject* gobj,
+ gboolean is_last_ref);
+
void
ObjectInstance::gobj_dispose_notify(void)
{
m_gobj_disposed = true;
+
+ if (m_uses_toggle_ref) {
+ g_object_remove_toggle_ref(m_ptr, wrapped_gobj_toggle_notify, nullptr);
+ wrapped_gobj_toggle_notify(nullptr, m_ptr, TRUE);
+ }
}
void ObjectInstance::iterate_wrapped_gobjects(
@@ -1297,7 +1305,7 @@ void
ObjectInstance::release_native_object(void)
{
discard_wrapper();
- if (m_gobj_disposed)
+ if (m_uses_toggle_ref && m_gobj_disposed)
m_ptr.release();
else if (m_uses_toggle_ref)
g_object_remove_toggle_ref(m_ptr.release(), wrapped_gobj_toggle_notify,
--
GitLab

View File

@ -1,11 +1,10 @@
%global glib2_version 2.58.0
%global gobject_introspection_version 1.61.2
%global gtk3_version 3.20
%global glib2_version 2.66.0
%global gobject_introspection_version 1.66.0
%global mozjs78_version 78.8.0-1
Name: gjs
Version: 1.67.3
Release: 3%{?dist}
Version: 1.68.0
Release: 1%{?dist}
Summary: Javascript Bindings for GNOME
# The following files contain code from Mozilla which
@ -14,13 +13,7 @@ Summary: Javascript Bindings for GNOME
# Stack printer (gjs/stack.c)
License: MIT and (MPLv1.1 or GPLv2+ or LGPLv2+)
URL: https://wiki.gnome.org/Projects/Gjs
Source0: https://download.gnome.org/sources/%{name}/1.67/%{name}-%{version}.tar.xz
# Fix a frequent crash on unlock:
# https://gitlab.gnome.org/GNOME/gjs/-/merge_requests/588
# https://bugzilla.redhat.com/show_bug.cgi?id=1940171
# https://gitlab.gnome.org/GNOME/gjs/-/issues/387
Patch0: 588.patch
Source0: https://download.gnome.org/sources/%{name}/1.68/%{name}-%{version}.tar.xz
BuildRequires: cairo-gobject-devel
BuildRequires: dbus-daemon
@ -30,7 +23,8 @@ BuildRequires: meson
BuildRequires: gettext
BuildRequires: glib2-devel >= %{glib2_version}
BuildRequires: gobject-introspection-devel >= %{gobject_introspection_version}
BuildRequires: gtk3-devel >= %{gtk3_version}
BuildRequires: gtk3-devel
BuildRequires: gtk4-devel
BuildRequires: mozjs78-devel >= %{mozjs78_version}
BuildRequires: pkgconfig
BuildRequires: readline-devel
@ -41,7 +35,6 @@ BuildRequires: xorg-x11-server-Xvfb
Requires: glib2%{?_isa} >= %{glib2_version}
Requires: gobject-introspection%{?_isa} >= %{gobject_introspection_version}
Requires: gtk3%{?_isa} >= %{gtk3_version}
Requires: mozjs78%{?_isa} >= %{mozjs78_version}
# Filter provides for private libraries
@ -103,6 +96,9 @@ the functionality of the installed gjs package.
%{_datadir}/installed-tests/
%changelog
* Mon Mar 22 2021 Kalev Lember <klember@redhat.com> - 1.68.0-1
- Update to 1.68.0
* Fri Mar 19 2021 Adam Williamson <awilliam@redhat.com> - 1.67.3-3
- Replace MR #585 reversion with MR #588, hopefully correct fix

View File

@ -1 +1 @@
SHA512 (gjs-1.67.3.tar.xz) = 9bd6d58e2322cb7354cf29c7327127276f947f514c80b10831f8f8b36854b7b34da811eff26d41fa7e74e42421df0ffab3a0e6896eb73cca456235c3f2dd1499
SHA512 (gjs-1.68.0.tar.xz) = 65278ca345f2c786995bed7755dd86403b469eb6cceaa6db57dbd4af212025a3b1f01b7387f45dc9abc23d47ba2f39c5ab8a90ec95b1934f1471a68a06f0d82d