Merged update from upstream sources
This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/gjs.git#540d19c6d0103afc0f279ccdfbba28aba5f9b4d1
This commit is contained in:
parent
c034103608
commit
79715dd108
1
.gitignore
vendored
1
.gitignore
vendored
@ -116,3 +116,4 @@ gjs-0.7.1.tar.gz
|
||||
/gjs-1.66.2.tar.xz
|
||||
/gjs-1.67.1.tar.xz
|
||||
/gjs-1.67.2.tar.xz
|
||||
/gjs-1.67.3.tar.xz
|
||||
|
70
588.patch
Normal file
70
588.patch
Normal file
@ -0,0 +1,70 @@
|
||||
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
|
||||
|
264
gjs-gcc11.patch
264
gjs-gcc11.patch
@ -1,264 +0,0 @@
|
||||
From 0b8d5fa865603c43ff4bdc682cb004fefecb336d Mon Sep 17 00:00:00 2001
|
||||
From: Philip Chimento <philip.chimento@gmail.com>
|
||||
Date: Sun, 14 Feb 2021 12:09:38 -0800
|
||||
Subject: [PATCH 1/3] GjsPrivate: Fix indentation in function
|
||||
|
||||
Adding preprocessor directives to this code in a subsequent commit will
|
||||
cause clang-format to reformat parts of it, so just do it all at once.
|
||||
---
|
||||
libgjs-private/gjs-util.c | 43 ++++++++++++++++++++-------------------
|
||||
1 file changed, 22 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/libgjs-private/gjs-util.c b/libgjs-private/gjs-util.c
|
||||
index 6599567d..88a575b9 100644
|
||||
--- a/libgjs-private/gjs-util.c
|
||||
+++ b/libgjs-private/gjs-util.c
|
||||
@@ -36,27 +36,28 @@ gjs_format_int_alternative_output(int n)
|
||||
#endif
|
||||
}
|
||||
|
||||
-GType
|
||||
-gjs_locale_category_get_type(void)
|
||||
-{
|
||||
- static volatile size_t g_define_type_id__volatile = 0;
|
||||
- if (g_once_init_enter(&g_define_type_id__volatile)) {
|
||||
- static const GEnumValue v[] = {
|
||||
- { GJS_LOCALE_CATEGORY_ALL, "GJS_LOCALE_CATEGORY_ALL", "all" },
|
||||
- { GJS_LOCALE_CATEGORY_COLLATE, "GJS_LOCALE_CATEGORY_COLLATE", "collate" },
|
||||
- { GJS_LOCALE_CATEGORY_CTYPE, "GJS_LOCALE_CATEGORY_CTYPE", "ctype" },
|
||||
- { GJS_LOCALE_CATEGORY_MESSAGES, "GJS_LOCALE_CATEGORY_MESSAGES", "messages" },
|
||||
- { GJS_LOCALE_CATEGORY_MONETARY, "GJS_LOCALE_CATEGORY_MONETARY", "monetary" },
|
||||
- { GJS_LOCALE_CATEGORY_NUMERIC, "GJS_LOCALE_CATEGORY_NUMERIC", "numeric" },
|
||||
- { GJS_LOCALE_CATEGORY_TIME, "GJS_LOCALE_CATEGORY_TIME", "time" },
|
||||
- { 0, NULL, NULL }
|
||||
- };
|
||||
- GType g_define_type_id =
|
||||
- g_enum_register_static(g_intern_static_string("GjsLocaleCategory"), v);
|
||||
-
|
||||
- g_once_init_leave(&g_define_type_id__volatile, g_define_type_id);
|
||||
- }
|
||||
- return g_define_type_id__volatile;
|
||||
+GType gjs_locale_category_get_type(void) {
|
||||
+ static volatile size_t g_define_type_id__volatile = 0;
|
||||
+ if (g_once_init_enter(&g_define_type_id__volatile)) {
|
||||
+ static const GEnumValue v[] = {
|
||||
+ {GJS_LOCALE_CATEGORY_ALL, "GJS_LOCALE_CATEGORY_ALL", "all"},
|
||||
+ {GJS_LOCALE_CATEGORY_COLLATE, "GJS_LOCALE_CATEGORY_COLLATE",
|
||||
+ "collate"},
|
||||
+ {GJS_LOCALE_CATEGORY_CTYPE, "GJS_LOCALE_CATEGORY_CTYPE", "ctype"},
|
||||
+ {GJS_LOCALE_CATEGORY_MESSAGES, "GJS_LOCALE_CATEGORY_MESSAGES",
|
||||
+ "messages"},
|
||||
+ {GJS_LOCALE_CATEGORY_MONETARY, "GJS_LOCALE_CATEGORY_MONETARY",
|
||||
+ "monetary"},
|
||||
+ {GJS_LOCALE_CATEGORY_NUMERIC, "GJS_LOCALE_CATEGORY_NUMERIC",
|
||||
+ "numeric"},
|
||||
+ {GJS_LOCALE_CATEGORY_TIME, "GJS_LOCALE_CATEGORY_TIME", "time"},
|
||||
+ {0, NULL, NULL}};
|
||||
+ GType g_define_type_id = g_enum_register_static(
|
||||
+ g_intern_static_string("GjsLocaleCategory"), v);
|
||||
+
|
||||
+ g_once_init_leave(&g_define_type_id__volatile, g_define_type_id);
|
||||
+ }
|
||||
+ return g_define_type_id__volatile;
|
||||
}
|
||||
|
||||
/**
|
||||
--
|
||||
GitLab
|
||||
|
||||
|
||||
From 989ac9ac723dc1c8b6b8961292f236c558f5c0f0 Mon Sep 17 00:00:00 2001
|
||||
From: Philip Chimento <philip.chimento@gmail.com>
|
||||
Date: Mon, 15 Feb 2021 20:40:43 -0800
|
||||
Subject: [PATCH 2/3] GjsPrivate: Remove volatile from g_once_init_enter flag
|
||||
|
||||
On platforms where g_once_init_enter() is defined to use C11 atomic
|
||||
builtins, passing a pointer to a volatile value will generate a warning
|
||||
in GCC 11 and later.
|
||||
|
||||
More info about the GCC change:
|
||||
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95378
|
||||
https://gcc.gnu.org/pipermail/gcc-patches/2020-June/548283.html
|
||||
|
||||
More info about changes made in GLib:
|
||||
https://gitlab.gnome.org/GNOME/glib/-/issues/600
|
||||
|
||||
See: #376
|
||||
---
|
||||
libgjs-private/gjs-util.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/libgjs-private/gjs-util.c b/libgjs-private/gjs-util.c
|
||||
index 88a575b9..4fd268cd 100644
|
||||
--- a/libgjs-private/gjs-util.c
|
||||
+++ b/libgjs-private/gjs-util.c
|
||||
@@ -37,8 +37,8 @@ gjs_format_int_alternative_output(int n)
|
||||
}
|
||||
|
||||
GType gjs_locale_category_get_type(void) {
|
||||
- static volatile size_t g_define_type_id__volatile = 0;
|
||||
- if (g_once_init_enter(&g_define_type_id__volatile)) {
|
||||
+ static size_t gjs_locale_category_get_type = 0;
|
||||
+ if (g_once_init_enter(&gjs_locale_category_get_type)) {
|
||||
static const GEnumValue v[] = {
|
||||
{GJS_LOCALE_CATEGORY_ALL, "GJS_LOCALE_CATEGORY_ALL", "all"},
|
||||
{GJS_LOCALE_CATEGORY_COLLATE, "GJS_LOCALE_CATEGORY_COLLATE",
|
||||
@@ -55,9 +55,9 @@ GType gjs_locale_category_get_type(void) {
|
||||
GType g_define_type_id = g_enum_register_static(
|
||||
g_intern_static_string("GjsLocaleCategory"), v);
|
||||
|
||||
- g_once_init_leave(&g_define_type_id__volatile, g_define_type_id);
|
||||
+ g_once_init_leave(&gjs_locale_category_get_type, g_define_type_id);
|
||||
}
|
||||
- return g_define_type_id__volatile;
|
||||
+ return gjs_locale_category_get_type;
|
||||
}
|
||||
|
||||
/**
|
||||
--
|
||||
GitLab
|
||||
|
||||
|
||||
From f02eaf3a9d3465915eb849428c2d9615e2184a4c Mon Sep 17 00:00:00 2001
|
||||
From: Philip Chimento <philip.chimento@gmail.com>
|
||||
Date: Sun, 14 Feb 2021 12:20:09 -0800
|
||||
Subject: [PATCH 3/3] maint: Avoid g_once_init_enter error in GCC 11
|
||||
|
||||
On platforms where g_once_init_enter() is defined to use C11 atomic
|
||||
builtins, passing a pointer to a volatile value is an error in GCC 11 and
|
||||
later, in C++.
|
||||
|
||||
More info about the GCC change:
|
||||
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95378
|
||||
https://gcc.gnu.org/pipermail/gcc-patches/2020-June/548283.html
|
||||
|
||||
However, it's my understanding that in modern C++ there is no longer a
|
||||
need to guard the initialization of these variables. Since C++11, static
|
||||
local variables in a function are guaranteed to be initialized only once,
|
||||
the first time control passes through that function. So we can just remove
|
||||
the g_once_init_enter guard.
|
||||
|
||||
More info:
|
||||
https://en.cppreference.com/w/cpp/language/storage_duration#Static_local_variables
|
||||
|
||||
Stack Overflow answers with quotations from the C++ standard:
|
||||
https://stackoverflow.com/a/58804/172999
|
||||
https://stackoverflow.com/a/8102145/172999
|
||||
|
||||
Closes: #376
|
||||
---
|
||||
gjs/error-types.cpp | 32 +++++++++++++-------------------
|
||||
gjs/objectbox.cpp | 31 +++++++++++++------------------
|
||||
gjs/objectbox.h | 3 +++
|
||||
3 files changed, 29 insertions(+), 37 deletions(-)
|
||||
|
||||
diff --git a/gjs/error-types.cpp b/gjs/error-types.cpp
|
||||
index cdfd7fa3..4c652da4 100644
|
||||
--- a/gjs/error-types.cpp
|
||||
+++ b/gjs/error-types.cpp
|
||||
@@ -12,24 +12,18 @@ G_DEFINE_QUARK(gjs-js-error-quark, gjs_js_error)
|
||||
// clang-format on
|
||||
|
||||
GType gjs_js_error_get_type(void) {
|
||||
- static volatile GType g_type_id;
|
||||
-
|
||||
- if (g_once_init_enter(&g_type_id)) {
|
||||
- static GEnumValue errors[] = {
|
||||
- { GJS_JS_ERROR_ERROR, "Error", "error" },
|
||||
- { GJS_JS_ERROR_EVAL_ERROR, "EvalError", "eval-error" },
|
||||
- { GJS_JS_ERROR_INTERNAL_ERROR, "InternalError", "internal-error" },
|
||||
- { GJS_JS_ERROR_RANGE_ERROR, "RangeError", "range-error" },
|
||||
- { GJS_JS_ERROR_REFERENCE_ERROR, "ReferenceError", "reference-error" },
|
||||
- { GJS_JS_ERROR_STOP_ITERATION, "StopIteration", "stop-iteration" },
|
||||
- { GJS_JS_ERROR_SYNTAX_ERROR, "SyntaxError", "syntax-error" },
|
||||
- { GJS_JS_ERROR_TYPE_ERROR, "TypeError", "type-error" },
|
||||
- { GJS_JS_ERROR_URI_ERROR, "URIError", "uri-error" },
|
||||
- { 0, nullptr, nullptr }
|
||||
- };
|
||||
-
|
||||
- g_type_id = g_enum_register_static("GjsJSError", errors);
|
||||
- }
|
||||
-
|
||||
+ static const GEnumValue errors[] = {
|
||||
+ {GJS_JS_ERROR_ERROR, "Error", "error"},
|
||||
+ {GJS_JS_ERROR_EVAL_ERROR, "EvalError", "eval-error"},
|
||||
+ {GJS_JS_ERROR_INTERNAL_ERROR, "InternalError", "internal-error"},
|
||||
+ {GJS_JS_ERROR_RANGE_ERROR, "RangeError", "range-error"},
|
||||
+ {GJS_JS_ERROR_REFERENCE_ERROR, "ReferenceError", "reference-error"},
|
||||
+ {GJS_JS_ERROR_STOP_ITERATION, "StopIteration", "stop-iteration"},
|
||||
+ {GJS_JS_ERROR_SYNTAX_ERROR, "SyntaxError", "syntax-error"},
|
||||
+ {GJS_JS_ERROR_TYPE_ERROR, "TypeError", "type-error"},
|
||||
+ {GJS_JS_ERROR_URI_ERROR, "URIError", "uri-error"},
|
||||
+ {0, nullptr, nullptr}};
|
||||
+ // Initialization of static local variable guaranteed only once in C++11
|
||||
+ static GType g_type_id = g_enum_register_static("GjsJSError", errors);
|
||||
return g_type_id;
|
||||
}
|
||||
diff --git a/gjs/objectbox.cpp b/gjs/objectbox.cpp
|
||||
index 3c60c05e..2ad6cddc 100644
|
||||
--- a/gjs/objectbox.cpp
|
||||
+++ b/gjs/objectbox.cpp
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
-#include <stddef.h> // for size_t
|
||||
-
|
||||
#include <algorithm> // for find
|
||||
|
||||
#include <glib.h>
|
||||
@@ -114,24 +112,21 @@ JSObject* ObjectBox::object_for_c_ptr(JSContext* cx, ObjectBox* box) {
|
||||
return box->m_impl->m_root.get();
|
||||
}
|
||||
|
||||
-GType ObjectBox::gtype() {
|
||||
- static volatile size_t type_id = 0;
|
||||
+void* ObjectBox::boxed_copy(void* boxed) {
|
||||
+ auto* box = static_cast<ObjectBox*>(boxed);
|
||||
+ box->m_impl->ref();
|
||||
+ return box;
|
||||
+}
|
||||
|
||||
- if (g_once_init_enter(&type_id)) {
|
||||
- auto objectbox_copy = [](void* boxed) -> void* {
|
||||
- auto* box = static_cast<ObjectBox*>(boxed);
|
||||
- box->m_impl->ref();
|
||||
- return box;
|
||||
- };
|
||||
- auto objectbox_free = [](void* boxed) {
|
||||
- auto* box = static_cast<ObjectBox*>(boxed);
|
||||
- box->m_impl->unref();
|
||||
- };
|
||||
- GType type = g_boxed_type_register_static("JSObject", objectbox_copy,
|
||||
- objectbox_free);
|
||||
- g_once_init_leave(&type_id, type);
|
||||
- }
|
||||
+void ObjectBox::boxed_free(void* boxed) {
|
||||
+ auto* box = static_cast<ObjectBox*>(boxed);
|
||||
+ box->m_impl->unref();
|
||||
+}
|
||||
|
||||
+GType ObjectBox::gtype() {
|
||||
+ // Initialization of static local variable guaranteed only once in C++11
|
||||
+ static GType type_id = g_boxed_type_register_static(
|
||||
+ "JSObject", &ObjectBox::boxed_copy, &ObjectBox::boxed_free);
|
||||
return type_id;
|
||||
}
|
||||
|
||||
diff --git a/gjs/objectbox.h b/gjs/objectbox.h
|
||||
index 276fd5b8..b2d3f349 100644
|
||||
--- a/gjs/objectbox.h
|
||||
+++ b/gjs/objectbox.h
|
||||
@@ -32,6 +32,9 @@ struct ObjectBox {
|
||||
private:
|
||||
explicit ObjectBox(JSObject*);
|
||||
|
||||
+ static void* boxed_copy(void*);
|
||||
+ static void boxed_free(void*);
|
||||
+
|
||||
struct impl;
|
||||
std::unique_ptr<impl> m_impl;
|
||||
};
|
||||
--
|
||||
GitLab
|
||||
|
27
gjs.spec
27
gjs.spec
@ -4,8 +4,8 @@
|
||||
%global mozjs78_version 78.8.0-1
|
||||
|
||||
Name: gjs
|
||||
Version: 1.67.2
|
||||
Release: 2%{?dist}
|
||||
Version: 1.67.3
|
||||
Release: 3%{?dist}
|
||||
Summary: Javascript Bindings for GNOME
|
||||
|
||||
# The following files contain code from Mozilla which
|
||||
@ -15,7 +15,12 @@ Summary: Javascript Bindings for GNOME
|
||||
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
|
||||
Patch0: %{name}-gcc11.patch
|
||||
|
||||
# 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
|
||||
|
||||
BuildRequires: cairo-gobject-devel
|
||||
BuildRequires: dbus-daemon
|
||||
@ -29,7 +34,7 @@ BuildRequires: gtk3-devel >= %{gtk3_version}
|
||||
BuildRequires: mozjs78-devel >= %{mozjs78_version}
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: readline-devel
|
||||
BuildRequires: sysprof-devel
|
||||
BuildRequires: sysprof-capture-devel
|
||||
|
||||
# xvfb for test suite
|
||||
BuildRequires: xorg-x11-server-Xvfb
|
||||
@ -73,10 +78,7 @@ the functionality of the installed gjs package.
|
||||
%meson_install
|
||||
|
||||
%check
|
||||
%ifnarch i686
|
||||
# One test times out on i686
|
||||
xvfb-run -s "-screen 0 1600x1200x24" eval "%meson_test"
|
||||
%endif
|
||||
%{shrink:xvfb-run -s "-screen 0 1600x1200x24" %meson_test}
|
||||
|
||||
%files
|
||||
%license COPYING
|
||||
@ -101,6 +103,15 @@ xvfb-run -s "-screen 0 1600x1200x24" eval "%meson_test"
|
||||
%{_datadir}/installed-tests/
|
||||
|
||||
%changelog
|
||||
* Fri Mar 19 2021 Adam Williamson <awilliam@redhat.com> - 1.67.3-3
|
||||
- Replace MR #585 reversion with MR #588, hopefully correct fix
|
||||
|
||||
* Thu Mar 18 2021 Adam Williamson <awilliam@redhat.com> - 1.67.3-2
|
||||
- Patches to revert MR #585 to work around frequent crash on unlock
|
||||
|
||||
* Mon Mar 15 2021 Kalev Lember <klember@redhat.com> - 1.67.3-1
|
||||
- Update to 1.67.3
|
||||
|
||||
* Tue Feb 23 2021 Frantisek Zatloukal <fzatlouk@redhat.com> - 1.67.2-2
|
||||
- Rebuild against mozjs78-78.8.0-1
|
||||
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (gjs-1.67.2.tar.xz) = accdb003e5acd6ddb317410f598e7c146e3c7a9e056021aee79ae21f3e424713b89b337a48e4292a6b3676f80de1509eca7d3fe0955b893da398bb992f237d23
|
||||
SHA512 (gjs-1.67.3.tar.xz) = 9bd6d58e2322cb7354cf29c7327127276f947f514c80b10831f8f8b36854b7b34da811eff26d41fa7e74e42421df0ffab3a0e6896eb73cca456235c3f2dd1499
|
||||
|
Loading…
Reference in New Issue
Block a user