From a56fd747a69b07b8ba998c25c5dc7b47d9bea941 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Mon, 7 Sep 2020 00:02:34 -0700 Subject: [PATCH] Imported Upstream version 2.46.0 --- .gitignore | 6 +-- MSVC_Net2013/glibmm-install.props | 1 + MSVC_Net2013/glibmm.vcxproj | 1 + MSVC_Net2013/glibmm.vcxproj.filters | 1 + NEWS | 17 ++++++ configure.ac | 6 +-- gio/src/application.hg | 7 +-- gio/src/dbusconnection.ccg | 8 ++- gio/src/gio_extra_objects.defs | 12 +++++ gio/src/gio_methods.defs | 9 ++++ gio/src/gio_signals.defs | 24 +++++++++ glib/glibmm.h | 1 + glib/glibmm/refptr.h | 35 +++++++++++++ glib/glibmm/weakref.h | 86 ++++++++++++++++--------------- tests/glibmm_weakref/main.cc | 1 - tools/extra_defs_gen/generate_defs_gio.cc | 2 + 16 files changed, 162 insertions(+), 55 deletions(-) diff --git a/.gitignore b/.gitignore index 4ecdee3..b4604f3 100644 --- a/.gitignore +++ b/.gitignore @@ -40,10 +40,8 @@ giommconfig.h /build/test-driver # MSVC_Net20*/ -/MSVC_Net200[58]/giomm/giomm.rc -/MSVC_Net200[58]/glibmm/glibmm.rc -/MSVC_Net2010/giomm/giomm.rc -/MSVC_Net2010/glibmm/glibmm.rc +/MSVC_Net201?/giomm/giomm.rc +/MSVC_Net201?/glibmm/glibmm.rc # docs/ /docs/doc-install.pl diff --git a/MSVC_Net2013/glibmm-install.props b/MSVC_Net2013/glibmm-install.props index 0466683..f039e6b 100644 --- a/MSVC_Net2013/glibmm-install.props +++ b/MSVC_Net2013/glibmm-install.props @@ -97,6 +97,7 @@ copy ..\glib\glibmm\valuearray.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$( copy ..\glib\glibmm\value_basictypes.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\value_custom.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\vectorutils.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm +copy ..\glib\glibmm\weakref.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\wrap.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\wrap_init.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm diff --git a/MSVC_Net2013/glibmm.vcxproj b/MSVC_Net2013/glibmm.vcxproj index f437024..8bfeb6e 100644 --- a/MSVC_Net2013/glibmm.vcxproj +++ b/MSVC_Net2013/glibmm.vcxproj @@ -341,6 +341,7 @@ + diff --git a/MSVC_Net2013/glibmm.vcxproj.filters b/MSVC_Net2013/glibmm.vcxproj.filters index f2aa89b..7887ad2 100644 --- a/MSVC_Net2013/glibmm.vcxproj.filters +++ b/MSVC_Net2013/glibmm.vcxproj.filters @@ -158,6 +158,7 @@ Header Files Header Files Header Files + Header Files Header Files Header Files diff --git a/NEWS b/NEWS index d6d1085..16bb1a0 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,20 @@ +2.46.0 (stable): + +Glib:: +* RefPtr: Make it possible to stop use of RefPtr with certain classes. + (Kjell Ahlstedt) Bug #755048 +* WeakRef: Use noexcept. + (Kjell Ahlstedt) Bug #583399. + +Gio: +* Application: Remove bind/unbind_busy_property() because they are not + quite ready. + (Murray Cumming) + +Gio::Dbus: +* Connection::signal_subscribe(): Pass nullptr instead of "". + (Murray Cumming) + 2.45.80 (unstable): Gio: diff --git a/configure.ac b/configure.ac index ef6b1e4..386471d 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,7 @@ ## You should have received a copy of the GNU Lesser General Public License ## along with this library. If not, see . -AC_INIT([glibmm], [2.45.80], +AC_INIT([glibmm], [2.46.0], [http://bugzilla.gnome.org/enter_bug.cgi?product=glibmm], [glibmm], [http://www.gtkmm.org/]) AC_PREREQ([2.59]) @@ -62,9 +62,9 @@ AS_IF([test "x$enable_static" = xyes], AC_DEFINE([GIOMM_STATIC_LIB], [1], [Define if giomm is built as a static library]) ]) -glibreq='2.0 >= 2.45.8' +glibreq='2.0 >= 2.46.0' -GLIBMM_MODULES="sigc++-2.0 >= 2.5.4 glib-$glibreq gobject-$glibreq gmodule-$glibreq" +GLIBMM_MODULES="sigc++-2.0 >= 2.6.0 glib-$glibreq gobject-$glibreq gmodule-$glibreq" GIOMM_MODULES="$GLIBMM_MODULES gio-$glibreq" test "x$glibmm_host_windows" = xyes || GIOMM_MODULES="$GIOMM_MODULES gio-unix-$glibreq" diff --git a/gio/src/application.hg b/gio/src/application.hg index 33a2249..d87efc3 100644 --- a/gio/src/application.hg +++ b/gio/src/application.hg @@ -354,9 +354,10 @@ public: _WRAP_METHOD(void send_notification(const Glib::ustring& id{?}, const Glib::RefPtr& notification), g_application_send_notification) _WRAP_METHOD(void withdraw_notification(const Glib::ustring& id), g_application_withdraw_notification) -#m4 _CONVERSION(`const Glib::ObjectBase&', `gpointer', `const_cast(($3).gobj())') - _WRAP_METHOD(void bind_busy_property(const Glib::ObjectBase& object, const Glib::ustring& property), g_application_bind_busy_property) - _WRAP_METHOD(void unbind_busy_property(const Glib::ObjectBase& object, const Glib::ustring& property), g_application_unbind_busy_property) +//TODO: Glib::RefPtr, Glib::ObjectBase, or both? +//#m4 _CONVERSION(`const Glib::RefPtr&', `gpointer', `($3)->gobj()') +// _WRAP_METHOD(void bind_busy_property(const Glib::RefPtr& object, const Glib::ustring& property), g_application_bind_busy_property) +// _WRAP_METHOD(void unbind_busy_property(const Glib::RefPtr& object, const Glib::ustring& property), g_application_unbind_busy_property) _WRAP_PROPERTY("action-group", Glib::RefPtr, deprecated "Use the Gio::ActionMap interface instead.") _WRAP_PROPERTY("application-id", Glib::ustring) diff --git a/gio/src/dbusconnection.ccg b/gio/src/dbusconnection.ccg index 0e9faf6..935a5d6 100644 --- a/gio/src/dbusconnection.ccg +++ b/gio/src/dbusconnection.ccg @@ -807,8 +807,12 @@ guint Connection::signal_subscribe( { auto slot_copy = new SlotSignal(slot); - return g_dbus_connection_signal_subscribe(gobj(), sender.c_str(), - interface_name.c_str(), member.c_str(), object_path.c_str(), arg0.c_str(), + return g_dbus_connection_signal_subscribe(gobj(), + (sender.empty() ? nullptr : sender.c_str()), + (interface_name.empty() ? nullptr : interface_name.c_str()), + (member.empty() ? nullptr : member.c_str()), + (object_path.empty() ? nullptr : object_path.c_str()), + (arg0.empty() ? nullptr : arg0.c_str()), static_cast(flags), &DBusConnection_Signal_giomm_callback, slot_copy, &DBusConnection_Signal_giomm_callback_destroy); diff --git a/gio/src/gio_extra_objects.defs b/gio/src/gio_extra_objects.defs index c1ed447..4f75f32 100644 --- a/gio/src/gio_extra_objects.defs +++ b/gio/src/gio_extra_objects.defs @@ -139,6 +139,18 @@ (gtype-id "G_TYPE_FILE_INFO") ) +(define-object ListModel + (in-module "Gio") + (c-name "GListModel") + (gtype-id "G_TYPE_LIST_MODEL") +) + +(define-object ListStore + (in-module "Gio") + (c-name "GListStore") + (gtype-id "G_TYPE_LIST_STORE") +) + (define-object Menu (in-module "Gio") (c-name "GMenu") diff --git a/gio/src/gio_methods.defs b/gio/src/gio_methods.defs index 3ed488c..9b82084 100644 --- a/gio/src/gio_methods.defs +++ b/gio/src/gio_methods.defs @@ -10958,6 +10958,15 @@ ;; From gliststore.h +(define-function g_list_store_new + (c-name "g_list_store_new") + (is-constructor-of "GListStore") + (return-type "GListStore*") + (parameters + '("GType" "item_type") + ) +) + (define-method insert (of-object "GListStore") (c-name "g_list_store_insert") diff --git a/gio/src/gio_signals.defs b/gio/src/gio_signals.defs index 5677c11..5f40b2a 100644 --- a/gio/src/gio_signals.defs +++ b/gio/src/gio_signals.defs @@ -574,6 +574,30 @@ ;; From GInputStream +;; From GListModel + +(define-signal items-changed + (of-object "GListModel") + (return-type "void") + (when "last") + (parameters + '("guint" "p0") + '("guint" "p1") + '("guint" "p2") + ) +) + +;; From GListStore + +(define-property item-type + (of-object "GListStore") + (prop-type "GParamGType") + (docs "") + (readable #t) + (writable #t) + (construct-only #t) +) + ;; From GLoadableIcon ;; From GMemoryInputStream diff --git a/glib/glibmm.h b/glib/glibmm.h index fb409f8..a8199c2 100644 --- a/glib/glibmm.h +++ b/glib/glibmm.h @@ -150,6 +150,7 @@ #include #include #include +#include #include #endif /* _GLIBMM_H */ diff --git a/glib/glibmm/refptr.h b/glib/glibmm/refptr.h index b4e2b41..a7ca0fc 100644 --- a/glib/glibmm/refptr.h +++ b/glib/glibmm/refptr.h @@ -52,6 +52,41 @@ namespace Glib template class RefPtr { +private: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + /** Helper class for disallowing use of Glib::RefPtr with certain classes. + * + * Disallow for instance in Gtk::Widget and its subclasses. + * Glib::RefPtr::is_allowed_type::value is false if + * T:dont_allow_use_in_glib_refptr_ is a public type, else it's true. + * Example: + * @code + * typedef int dont_allow_use_in_glib_refptr_; + * @endcode + */ + class is_allowed_type + { + private: + struct big + { + int memory[64]; + }; + + static big check(...); + + // If X::dont_allow_use_in_glib_refptr_ is not a type, this check() overload + // is ignored because of the SFINAE rule (Substitution Failure Is Not An Error). + template + static typename X::dont_allow_use_in_glib_refptr_ check(X* obj); + + public: + static const bool value = sizeof(check(static_cast(nullptr))) == sizeof(big); + }; + + static_assert(is_allowed_type::value, + "Glib::RefPtr must not be used with this class."); +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + public: /** Default constructor * diff --git a/glib/glibmm/weakref.h b/glib/glibmm/weakref.h index cfdf493..d01c658 100644 --- a/glib/glibmm/weakref.h +++ b/glib/glibmm/weakref.h @@ -28,7 +28,9 @@ namespace Glib /** WeakRef<> is a weak reference smartpointer. * - * WeakRef can store a pointer to any class that is derived from Glib::ObjectBase. + * WeakRef can store a pointer to any class that is derived from Glib::ObjectBase, + * and whose reference() method is noexcept. + * In glibmm and gtkmm, that is anything derived from Glib::ObjectBase. * * Unlike a RefPtr, a WeakRef does not contribute to the reference counting of * the underlying object. @@ -46,21 +48,21 @@ public: * * Create an empty weak reference. */ - inline WeakRef(); + inline WeakRef() noexcept; /// Copy constructor. - inline WeakRef(const WeakRef& src); + inline WeakRef(const WeakRef& src) noexcept; /// Move constructor. - inline WeakRef(WeakRef&& src); + inline WeakRef(WeakRef&& src) noexcept; /// Copy constructor from different, but castable type. template - inline WeakRef(const WeakRef& src); + inline WeakRef(const WeakRef& src) noexcept; /// Move constructor from different, but castable type. template - inline WeakRef(WeakRef&& src); + inline WeakRef(WeakRef&& src) noexcept; /** Constructor from a RefPtr of the same or a castable type. * @@ -68,31 +70,31 @@ public: * If the RefPtr references nothing, an empty weak reference will be constructed. */ template - inline WeakRef(const RefPtr& src); + inline WeakRef(const RefPtr& src) noexcept; /// Destructor. - inline ~WeakRef(); + inline ~WeakRef() noexcept; /// Swap the contents of two WeakRef<>. - inline void swap(WeakRef& other); + inline void swap(WeakRef& other) noexcept; /// Copy assignment operator. - inline WeakRef& operator=(const WeakRef& src); + inline WeakRef& operator=(const WeakRef& src) noexcept; /// Move assignment operator. - inline WeakRef& operator=(WeakRef&& src); + inline WeakRef& operator=(WeakRef&& src) noexcept; /// Copy assignment from different, but castable type. template - inline WeakRef& operator=(const WeakRef& src); + inline WeakRef& operator=(const WeakRef& src) noexcept; /// Move assignment from different, but castable type. template - inline WeakRef& operator=(WeakRef&& src); + inline WeakRef& operator=(WeakRef&& src) noexcept; /// Assignment from a RefPtr of the same or a castable type. template - inline WeakRef& operator=(const RefPtr& src); + inline WeakRef& operator=(const RefPtr& src) noexcept; /** Test whether the WeakRef<> points to any underlying instance. * @@ -107,17 +109,17 @@ public: * because the underlying instance may lose its last reference in another * thread. Use get() if this is not acceptable. */ - inline explicit operator bool() const; + inline explicit operator bool() const noexcept; /** Create a strong reference to the underlying object. * * This is a thread-safe way to acquire a strong reference to the underlying * object. If the WeakRef is empty, the returned RefPtr will reference nothing. */ - inline RefPtr get() const; + inline RefPtr get() const noexcept; /// Make this WeakRef empty. - inline void reset(); + inline void reset() noexcept; /** Dynamic cast to derived class. * @@ -127,7 +129,7 @@ public: * @endcode */ template - static inline WeakRef cast_dynamic(const WeakRef& src); + static inline WeakRef cast_dynamic(const WeakRef& src) noexcept; /** Static cast to derived class. * @@ -137,7 +139,7 @@ public: * @endcode */ template - static inline WeakRef cast_static(const WeakRef& src); + static inline WeakRef cast_static(const WeakRef& src) noexcept; /** Cast to non-const. * @@ -147,7 +149,7 @@ public: * @endcode */ template - static inline WeakRef cast_const(const WeakRef& src); + static inline WeakRef cast_const(const WeakRef& src) noexcept; private: // Let all instantiations of WeakRef access private data. @@ -156,7 +158,7 @@ private: // If pCppObject != nullptr && gobject == nullptr, // then the caller holds a strong reference. - inline void set(T_CppObject* pCppObject, GWeakRef* gobject); + void set(T_CppObject* pCppObject, GWeakRef* gobject) noexcept; // WeakRef owns *gobject_, but it does not own *pCppObject_. // Invariant: (!pCppObject_ || gobject_), @@ -174,14 +176,14 @@ private: #ifndef DOXYGEN_SHOULD_SKIP_THIS template -WeakRef::WeakRef() +WeakRef::WeakRef() noexcept : pCppObject_(nullptr), gobject_(nullptr) { } template -WeakRef::WeakRef(const WeakRef& src) +WeakRef::WeakRef(const WeakRef& src) noexcept : pCppObject_(src.pCppObject_), gobject_(nullptr) { @@ -202,7 +204,7 @@ pCppObject_(src.pCppObject_), gobject_(nullptr) } template -WeakRef::WeakRef(WeakRef&& src) +WeakRef::WeakRef(WeakRef&& src) noexcept : pCppObject_(src.pCppObject_), gobject_(src.gobject_) { @@ -214,7 +216,7 @@ pCppObject_(src.pCppObject_), gobject_(src.gobject_) // castable. Thus, it does downcasts: // base_ref = derived_ref template template -WeakRef::WeakRef(const WeakRef& src) +WeakRef::WeakRef(const WeakRef& src) noexcept : pCppObject_(src.pCppObject_), gobject_(nullptr) { @@ -238,7 +240,7 @@ pCppObject_(src.pCppObject_), gobject_(nullptr) // castable. Thus, it does downcasts: // base_ref = std::move(derived_ref) template template -WeakRef::WeakRef(WeakRef&& src) +WeakRef::WeakRef(WeakRef&& src) noexcept : pCppObject_(src.pCppObject_), gobject_(src.gobject_) { @@ -247,7 +249,7 @@ pCppObject_(src.pCppObject_), gobject_(src.gobject_) } template template -WeakRef::WeakRef(const RefPtr& src) +WeakRef::WeakRef(const RefPtr& src) noexcept : pCppObject_(src.operator->()), gobject_(nullptr) { @@ -259,7 +261,7 @@ pCppObject_(src.operator->()), gobject_(nullptr) } template -WeakRef::~WeakRef() +WeakRef::~WeakRef() noexcept { if (gobject_) { @@ -269,21 +271,21 @@ WeakRef::~WeakRef() } template -void WeakRef::swap(WeakRef& other) +void WeakRef::swap(WeakRef& other) noexcept { std::swap(pCppObject_, other.pCppObject_); std::swap(gobject_, other.gobject_); } template -WeakRef& WeakRef::operator=(const WeakRef& src) +WeakRef& WeakRef::operator=(const WeakRef& src) noexcept { set(src.pCppObject_, src.gobject_); return *this; } template -WeakRef& WeakRef::operator=(WeakRef&& src) +WeakRef& WeakRef::operator=(WeakRef&& src) noexcept { // See RefPtr for an explanation of the swap() technique to implement // copy assignment and move assignment. @@ -297,14 +299,14 @@ WeakRef& WeakRef::operator=(WeakRef&& src) } template template -WeakRef& WeakRef::operator=(const WeakRef& src) +WeakRef& WeakRef::operator=(const WeakRef& src) noexcept { set(src.pCppObject_, src.gobject_); return *this; } template template -WeakRef& WeakRef::operator=(WeakRef&& src) +WeakRef& WeakRef::operator=(WeakRef&& src) noexcept { WeakRef temp(std::forward>(src)); this->swap(temp); @@ -312,7 +314,7 @@ WeakRef& WeakRef::operator=(WeakRef&& src) } template template -WeakRef& WeakRef::operator=(const RefPtr& src) +WeakRef& WeakRef::operator=(const RefPtr& src) noexcept { T_CppObject* pCppObject = src.operator->(); set(pCppObject, nullptr); @@ -320,7 +322,7 @@ WeakRef& WeakRef::operator=(const RefPtr& } template -WeakRef::operator bool() const +WeakRef::operator bool() const noexcept { if (!pCppObject_) return false; @@ -334,7 +336,7 @@ WeakRef::operator bool() const } template -RefPtr WeakRef::get() const +RefPtr WeakRef::get() const noexcept { RefPtr ret; @@ -355,13 +357,13 @@ RefPtr WeakRef::get() const } template -void WeakRef::reset() +void WeakRef::reset() noexcept { set(nullptr, nullptr); } template template -WeakRef WeakRef::cast_dynamic(const WeakRef& src) +WeakRef WeakRef::cast_dynamic(const WeakRef& src) noexcept { WeakRef ret; @@ -382,7 +384,7 @@ WeakRef WeakRef::cast_dynamic(const WeakRef template -WeakRef WeakRef::cast_static(const WeakRef& src) +WeakRef WeakRef::cast_static(const WeakRef& src) noexcept { T_CppObject *const pCppObject = static_cast(src.pCppObject_); @@ -392,7 +394,7 @@ WeakRef WeakRef::cast_static(const WeakRef } template template -WeakRef WeakRef::cast_const(const WeakRef& src) +WeakRef WeakRef::cast_const(const WeakRef& src) noexcept { T_CppObject *const pCppObject = const_cast(src.pCppObject_); @@ -402,7 +404,7 @@ WeakRef WeakRef::cast_const(const WeakRef& } template -void WeakRef::set(T_CppObject* pCppObject, GWeakRef* gobject) +void WeakRef::set(T_CppObject* pCppObject, GWeakRef* gobject) noexcept { // We must own a strong reference to the underlying GObject while // calling g_weak_ref_init() or g_weak_ref_set(). @@ -437,7 +439,7 @@ void WeakRef::set(T_CppObject* pCppObject, GWeakRef* gobject) * @relates Glib::WeakRef */ template inline -void swap(WeakRef& lhs, WeakRef& rhs) +void swap(WeakRef& lhs, WeakRef& rhs) noexcept { lhs.swap(rhs); } diff --git a/tests/glibmm_weakref/main.cc b/tests/glibmm_weakref/main.cc index 715ca1d..fdf935c 100644 --- a/tests/glibmm_weakref/main.cc +++ b/tests/glibmm_weakref/main.cc @@ -19,7 +19,6 @@ #include #include #include // std::move -#include //!! Until it's included in glibmm.h int main(int, char**) { diff --git a/tools/extra_defs_gen/generate_defs_gio.cc b/tools/extra_defs_gen/generate_defs_gio.cc index 602b59b..87544db 100644 --- a/tools/extra_defs_gen/generate_defs_gio.cc +++ b/tools/extra_defs_gen/generate_defs_gio.cc @@ -74,6 +74,8 @@ int main(int, char**) #endif << get_defs(G_TYPE_INPUT_STREAM) + << get_defs(G_TYPE_LIST_MODEL) + << get_defs(G_TYPE_LIST_STORE) << get_defs(G_TYPE_LOADABLE_ICON) << get_defs(G_TYPE_MEMORY_INPUT_STREAM) << get_defs(G_TYPE_MEMORY_OUTPUT_STREAM) -- 2.7.4