From: DongHun Kwak Date: Mon, 7 Sep 2020 07:17:20 +0000 (-0700) Subject: Imported Upstream version 2.50.1 X-Git-Tag: upstream/2.50.1^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5748118835db678a4e89e8ea61e1b4e4245aed0c;p=platform%2Fupstream%2Fglibmm.git Imported Upstream version 2.50.1 --- diff --git a/MSVC_Net2013/glibmm-install.props b/MSVC_Net2013/glibmm-install.props index 2848409..f28a0c8 100644 --- a/MSVC_Net2013/glibmm-install.props +++ b/MSVC_Net2013/glibmm-install.props @@ -11,7 +11,9 @@ mkdir $(CopyDir) mkdir $(CopyDir)\bin copy $(BinDir)\glibmm-vc$(VSVer)0-$(ApiMajorVersion)_$(ApiMinorVersion).dll $(CopyDir)\bin +copy $(BinDir)\glibmm-vc$(VSVer)0-$(ApiMajorVersion)_$(ApiMinorVersion).pdb $(CopyDir)\bin copy $(BinDir)\giomm-vc$(VSVer)0-$(ApiMajorVersion)_$(ApiMinorVersion).dll $(CopyDir)\bin +copy $(BinDir)\giomm-vc$(VSVer)0-$(ApiMajorVersion)_$(ApiMinorVersion).pdb $(CopyDir)\bin mkdir $(CopyDir)\lib\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\include mkdir $(CopyDir)\lib\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\include diff --git a/NEWS b/NEWS index cdad141..b0fd906 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,35 @@ -2.50.0: +2.50.1 (stable): + +Glib +* Dispatcher: Don't cast a HANDLE to an int on Windows. + (Kjell Ahlstedt) Bug 772074 + +Gio: +* Action: Include variant.h in the header. + (Daniel Boles) Bug #777953 +* Application::get_default(): Correct the refcounting. + (Daniel Boles) Bug #779936 +* SettingsSchemaSource: Correct the refcounting. + (Marcin Kolny) Bug #774593 + +Gio::DBus +* Proxy: Fix memory leak in get_cached_property_names(). + (Kjell Ahlstedt) Bug #775210 + +Documentation: +* Glib::Variant: Improve documentation of "maybe" types. + (Daniel Boles) Bug #778219 + Gio::ActionMap: Clarify doc of ActivateWithParameterSlot. + (Daniel Boles) + +Build: +* C++11: Variant: Replace throw(std::bad_cast) with noexcept(false). + See https://bugzilla.redhat.com/show_bug.cgi?id=1438766 +* Visual Studio: Install the .pdb files. + (Chun-wei Fan) + + +2.50.0 (stable): No changes since 2.49.7. diff --git a/configure.ac b/configure.ac index 671c13e..02352bd 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.50.0], +AC_INIT([glibmm], [2.50.1], [http://bugzilla.gnome.org/enter_bug.cgi?product=glibmm], [glibmm], [http://www.gtkmm.org/]) AC_PREREQ([2.59]) diff --git a/examples/thread/dispatcher2.cc b/examples/thread/dispatcher2.cc index d56c5e7..9801161 100644 --- a/examples/thread/dispatcher2.cc +++ b/examples/thread/dispatcher2.cc @@ -85,10 +85,6 @@ ThreadTimer::ThreadTimer() signal_increment_.connect(sigc::mem_fun(*this, &ThreadTimer::timer_increment)); } -ThreadTimer::~ThreadTimer() -{ -} - void ThreadTimer::launch() { diff --git a/gio/src/action.ccg b/gio/src/action.ccg index 9dbb598..c5a1735 100644 --- a/gio/src/action.ccg +++ b/gio/src/action.ccg @@ -17,8 +17,6 @@ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include #include namespace Gio diff --git a/gio/src/action.hg b/gio/src/action.hg index a7ce66e..f05d226 100644 --- a/gio/src/action.hg +++ b/gio/src/action.hg @@ -18,6 +18,7 @@ _CONFIGINCLUDE(giommconfig.h) #include +#include #include #include @@ -29,13 +30,6 @@ _PINCLUDE(gio/gio.h) typedef struct _GActionInterface GActionInterface; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ -namespace Glib -{ - -class VariantBase; - -} - namespace Gio { diff --git a/gio/src/actionmap.hg b/gio/src/actionmap.hg index 22241f1..6e59a62 100644 --- a/gio/src/actionmap.hg +++ b/gio/src/actionmap.hg @@ -53,7 +53,8 @@ public: _WRAP_METHOD(Glib::RefPtr lookup_action(const Glib::ustring& action_name), g_action_map_lookup_action, refreturn) _WRAP_METHOD(Glib::RefPtr lookup_action(const Glib::ustring& action_name) const, g_action_map_lookup_action, constversion, refreturn) - /** A Slot to be called when an action has been activated. + /** A Slot to be called when an action has been activated, + * passing a parameter of a specified type. * See add_action_with_parameter(). * * For instance, @@ -83,7 +84,7 @@ public: /** A Slot to be called when an action has been activated, * without passing a parameter to the slot. - * See add_action(). + * See add_action() and add_action_bool(). * * For instance, * void on_slot_activated(); @@ -134,7 +135,7 @@ public: * See add_action_radio_string(). * * For instance, - * void on_slot_activated(const Glib::VariantBase& parameter); + * void on_slot_activated(const Glib::ustring& parameter); */ using ActivateWithStringParameterSlot = sigc::slot; @@ -160,10 +161,10 @@ public: Glib::RefPtr add_action_radio_integer(const Glib::ustring& name, gint32 state); /** A Slot to be called when an action has been activated. - * See add_action_radio_int(). + * See add_action_radio_integer(). * * For instance, - * void on_slot_activated(const Glib::VariantBase& parameter); + * void on_slot_activated(int parameter); */ using ActivateWithIntParameterSlot = sigc::slot; diff --git a/gio/src/application.hg b/gio/src/application.hg index 626fa66..f9432ed 100644 --- a/gio/src/application.hg +++ b/gio/src/application.hg @@ -345,7 +345,7 @@ public: /// Unsets any existing default application. static void unset_default(); - _WRAP_METHOD(static Glib::RefPtr get_default(), g_application_get_default) + _WRAP_METHOD(static Glib::RefPtr get_default(), g_application_get_default, refreturn) _WRAP_METHOD(void mark_busy(), g_application_mark_busy) _WRAP_METHOD(void unmark_busy(), g_application_unmark_busy) diff --git a/gio/src/dbusproxy.hg b/gio/src/dbusproxy.hg index 2e3729f..a6e7419 100644 --- a/gio/src/dbusproxy.hg +++ b/gio/src/dbusproxy.hg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -255,7 +253,7 @@ public: _WRAP_METHOD(void set_cached_property(const Glib::ustring& property_name, const Glib::VariantBase& value), g_dbus_proxy_set_cached_property) -#m4 _CONVERSION(`gchar**', `Glib::StringArrayHandle', `Glib::StringArrayHandle($3)') +#m4 _CONVERSION(`gchar**', `Glib::StringArrayHandle', `Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)') _WRAP_METHOD(Glib::StringArrayHandle get_cached_property_names() const, g_dbus_proxy_get_cached_property_names) _WRAP_METHOD(void set_interface_info(const Glib::RefPtr& info), g_dbus_proxy_set_interface_info) diff --git a/gio/src/settingsschemasource.hg b/gio/src/settingsschemasource.hg index 4097e93..f330945 100644 --- a/gio/src/settingsschemasource.hg +++ b/gio/src/settingsschemasource.hg @@ -44,7 +44,7 @@ protected: public: - _WRAP_METHOD(static Glib::RefPtr get_default(), g_settings_schema_source_get_default) + _WRAP_METHOD(static Glib::RefPtr get_default(), g_settings_schema_source_get_default, refreturn) /* TODO: GLIB_AVAILABLE_IN_2_32 diff --git a/gio/src/simpleaction.hg b/gio/src/simpleaction.hg index d1e6f23..1c57541 100644 --- a/gio/src/simpleaction.hg +++ b/gio/src/simpleaction.hg @@ -53,9 +53,7 @@ protected: */ explicit SimpleAction(const Glib::ustring& name); - /** Creates a new new stateful action. - * - * The created action is stateless. + /** Creates a new stateful action. * * @a state is the initial state of the action. All future state values * must have the same VariantType as the initial state. diff --git a/glib/glibmm/dispatcher.cc b/glib/glibmm/dispatcher.cc index e21914a..d9067a3 100644 --- a/glib/glibmm/dispatcher.cc +++ b/glib/glibmm/dispatcher.cc @@ -198,11 +198,11 @@ DispatchNotifier::DispatchNotifier(const Glib::RefPtr& context) try { -#ifdef G_OS_WIN32 - const int fd = GPOINTER_TO_INT(fd_receiver_); -#else - const int fd = fd_receiver_; -#endif + // PollFD::fd_t is the type of GPollFD::fd. + // In Windows, it has the same size as HANDLE, but it's not guaranteed to be the same type. + // In Unix, a file descriptor is an int. + const auto fd = (PollFD::fd_t)fd_receiver_; + // The following code is equivalent to // context_->signal_io().connect( // sigc::mem_fun(*this, &DispatchNotifier::pipe_io_handler), fd, Glib::IO_IN); diff --git a/glib/glibmm/main.cc b/glib/glibmm/main.cc index d726eba..93ba40e 100644 --- a/glib/glibmm/main.cc +++ b/glib/glibmm/main.cc @@ -357,14 +357,14 @@ PollFD::PollFD() gobject_.revents = 0; } -PollFD::PollFD(int fd) +PollFD::PollFD(PollFD::fd_t fd) { gobject_.fd = fd; gobject_.events = 0; gobject_.revents = 0; } -PollFD::PollFD(int fd, IOCondition events) +PollFD::PollFD(PollFD::fd_t fd, IOCondition events) { gobject_.fd = fd; gobject_.events = events; @@ -490,7 +490,7 @@ inline SignalIO::SignalIO(GMainContext* context) : context_(context) sigc::connection SignalIO::connect( - const sigc::slot& slot, int fd, IOCondition condition, int priority) + const sigc::slot& slot, PollFD::fd_t fd, IOCondition condition, int priority) { const auto source = IOSource::create(fd, condition); @@ -1295,7 +1295,7 @@ IdleSource::dispatch(sigc::slot_base* slot) // static Glib::RefPtr -IOSource::create(int fd, IOCondition condition) +IOSource::create(PollFD::fd_t fd, IOCondition condition) { return Glib::RefPtr(new IOSource(fd, condition)); } @@ -1312,7 +1312,7 @@ IOSource::connect(const sigc::slot& slot) return connect_generic(slot); } -IOSource::IOSource(int fd, IOCondition condition) : poll_fd_(fd, condition) +IOSource::IOSource(PollFD::fd_t fd, IOCondition condition) : poll_fd_(fd, condition) { add_poll(poll_fd_); } diff --git a/glib/glibmm/main.h b/glib/glibmm/main.h index f60cc8f..c6dc839 100644 --- a/glib/glibmm/main.h +++ b/glib/glibmm/main.h @@ -49,12 +49,14 @@ class Mutex; class PollFD { public: + using fd_t = decltype(GPollFD::fd); + PollFD(); - explicit PollFD(int fd); - PollFD(int fd, IOCondition events); + explicit PollFD(fd_t fd); + PollFD(fd_t fd, IOCondition events); - void set_fd(int fd) { gobject_.fd = fd; } - int get_fd() const { return gobject_.fd; } + void set_fd(fd_t fd) { gobject_.fd = fd; } + fd_t get_fd() const { return gobject_.fd; } void set_events(IOCondition events) { gobject_.events = events; } IOCondition get_events() const { return static_cast(gobject_.events); } @@ -305,7 +307,7 @@ public: * @param priority The priority of the new event source. * @return A connection handle, which can be used to disconnect the handler. */ - sigc::connection connect(const sigc::slot& slot, int fd, IOCondition condition, + sigc::connection connect(const sigc::slot& slot, PollFD::fd_t fd, IOCondition condition, int priority = PRIORITY_DEFAULT); /** Connects an I/O handler that watches an I/O channel. @@ -887,13 +889,13 @@ class IOSource : public Glib::Source public: using CppObjectType = Glib::IOSource; - static Glib::RefPtr create(int fd, IOCondition condition); + static Glib::RefPtr create(PollFD::fd_t fd, IOCondition condition); static Glib::RefPtr create( const Glib::RefPtr& channel, IOCondition condition); sigc::connection connect(const sigc::slot& slot); protected: - IOSource(int fd, IOCondition condition); + IOSource(PollFD::fd_t fd, IOCondition condition); IOSource(const Glib::RefPtr& channel, IOCondition condition); /** Wrap an existing GSource object and install the given callback function. diff --git a/glib/src/variant.ccg b/glib/src/variant.ccg index d70af54..9c47dea 100644 --- a/glib/src/variant.ccg +++ b/glib/src/variant.ccg @@ -28,13 +28,10 @@ VariantBase::VariantBase(GVariant* castitem, bool make_a_copy /* = false */) if (castitem) { if (g_variant_is_floating(castitem)) - { g_variant_ref_sink(castitem); - } + if (make_a_copy) - { g_variant_ref(castitem); - } } gobject_ = castitem; @@ -158,9 +155,7 @@ VariantContainerBase::create_tuple(const std::vector& children) var_ptr* const var_array = new var_ptr[children.size()]; for (std::vector::size_type i = 0; i < children.size(); i++) - { var_array[i] = const_cast(children[i].gobj()); - } VariantContainerBase result = VariantContainerBase(g_variant_new_tuple(var_array, children.size())); @@ -199,12 +194,11 @@ VariantContainerBase::get_child(VariantBase& child, gsize index) const // VariantContainerBase has no method variant_type() template <> VariantContainerBase -VariantBase::cast_dynamic(const VariantBase& v) throw(std::bad_cast) +VariantBase::cast_dynamic(const VariantBase& v) noexcept(false) { if (!v.gobj()) - { return VariantContainerBase(); - } + if (v.get_type().is_container()) { return VariantContainerBase(const_cast(v.gobj()), true); @@ -227,7 +221,9 @@ VariantContainerBase::get_maybe(VariantBase& maybe) const return true; } else + { return false; + } } VariantIter @@ -339,7 +335,7 @@ Variant::get() const // See http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-get-string template <> Variant -VariantBase::cast_dynamic>(const VariantBase& v) throw(std::bad_cast) +VariantBase::cast_dynamic>(const VariantBase& v) noexcept(false) { if (!v.gobj()) { @@ -388,7 +384,7 @@ Variant::create(const std::string& data) // See http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-get-string template <> Variant -VariantBase::cast_dynamic>(const VariantBase& v) throw(std::bad_cast) +VariantBase::cast_dynamic>(const VariantBase& v) noexcept(false) { if (!v.gobj()) { @@ -456,9 +452,7 @@ Variant::create(const type_vec_ustring& data) // Add the elements of the vector into the builder. for (const auto& str : data) - { g_variant_builder_add(builder, element_variant_type.get_string().c_str(), str.c_str()); - } // Create the variant using the builder. auto result = @@ -493,7 +487,6 @@ Variant::get() const for (gsize i = 0; i < n_children; i++) { GVariant* gvariant = g_variant_get_child_value(const_cast(gobj()), i); - result.emplace_back(Glib::Variant(gvariant).get()); } @@ -534,9 +527,7 @@ Variant::create(const type_vec_string& data) // Add the elements of the vector into the string array. for (type_vec_string::size_type i = 0; i < data.size(); i++) - { str_array[i] = g_strdup(data[i].c_str()); - } // Terminate the string array. str_array[data.size()] = nullptr; @@ -557,9 +548,7 @@ Variant::create_from_object_paths(const type_vec_string& data) // Add the elements of the vector into the string array. for (type_vec_string::size_type i = 0; i < data.size(); i++) - { str_array[i] = g_strdup(data[i].c_str()); - } // Terminate the string array. str_array[data.size()] = nullptr; @@ -597,7 +586,6 @@ Variant::get() const for (gsize i = 0; i < n_children; i++) { GVariant* gvariant = g_variant_get_child_value(const_cast(gobj()), i); - result.emplace_back(Glib::Variant(gvariant).get()); } diff --git a/glib/src/variant.hg b/glib/src/variant.hg index f855db7..de10195 100644 --- a/glib/src/variant.hg +++ b/glib/src/variant.hg @@ -225,7 +225,7 @@ _DEPRECATE_IFDEF_END * @throws std::bad_cast if the Variant was not of the expected type. */ template - static V_CastTo cast_dynamic(const VariantBase& v) throw(std::bad_cast); + static V_CastTo cast_dynamic(const VariantBase& v) noexcept(false); _IGNORE(g_variant_dict_new) @@ -271,7 +271,7 @@ private: template V_CastTo VariantBase::cast_dynamic(const VariantBase& v) -throw(std::bad_cast) +noexcept(false) { if(!(v.gobj())) { @@ -340,8 +340,8 @@ public: _WRAP_METHOD(static bool is_signature(const std::string& string), g_variant_is_signature) }; -/** The base class from which multiple-item Variants derive, such as Variants - * containing tuples or arrays. +/** The base class for multiple-item Variants, such as Variants containing + * tuples or arrays, and also for maybe-typed (i.e. nullable) Variant types. * * @newin{2,28} * @ingroup Variant @@ -411,11 +411,12 @@ public: DataType get_child(gsize index = 0) const; */ - /** If this is a maybe-typed instance, extract its value. If the value is - * Nothing, then this function returns false. + /** If this is a maybe-typed instance, try to extract its value. If there is + * no value (the value is nothing), return falsetrue is returned. * - * @param maybe A place in which to return the value (the value may be - * 0). + * @param maybe A place in which to return the value, if it isn’t + * nothing. * @newin{2,28} */ bool get_maybe(VariantBase& maybe) const; @@ -432,7 +433,7 @@ protected: template<> VariantContainerBase VariantBase::cast_dynamic(const VariantBase& v) -throw(std::bad_cast); +noexcept(false); /** Template class used for the specialization of the Variant<> classes. * @newin{2,28} @@ -448,6 +449,9 @@ public: /****************** Specializations ***********************************/ /** Specialization of Variant containing a VariantBase. + * Perhaps the main use of this is as a maybe-typed (i.e. nullable) Variant, as + * it inherits methods create_maybe() and get_maybe() from VariantContainerBase. + * * @newin{2,28} * @ingroup Variant */ @@ -590,7 +594,7 @@ public: //TODO: When we can break ABI, remove this template specialization. template<> Variant VariantBase::cast_dynamic< Variant >(const VariantBase& v) -throw(std::bad_cast); +noexcept(false); /** Specialization of Variant containing a std::string, for variants of type * bytestring, string, object path, or signature. @@ -639,7 +643,7 @@ public: //TODO: When we can break ABI, remove this template specialization. template<> Variant VariantBase::cast_dynamic< Variant >(const VariantBase& v) -throw(std::bad_cast); +noexcept(false); /** Specialization of Variant containing a dictionary entry. See also * Variant< std::map >. @@ -753,7 +757,7 @@ public: _IGNORE(g_variant_get_fixed_array) /** Gets a VariantIter of the Variant. - * @return the VaraintIter. + * @return the VariantIter. * @newin{2,28} */ VariantIter get_iter() const; @@ -817,7 +821,7 @@ public: _IGNORE(g_variant_get_strv, g_variant_dup_strv) /** Gets a VariantIter of the Variant. - * @return the VaraintIter. + * @return the VariantIter. * @newin{2,28} */ VariantIter get_iter() const; @@ -893,7 +897,7 @@ public: _IGNORE(g_variant_get_objv, g_variant_dup_objv) /** Gets a VariantIter of the Variant. - * @return the VaraintIter. + * @return the VariantIter. * @newin{2,28} */ VariantIter get_iter() const; @@ -968,7 +972,7 @@ public: std::map get() const; /** Gets a VariantIter of the Variant. - * @return the VaraintIter. + * @return the VariantIter. * @newin{2,28} */ VariantIter get_iter() const;