Imported Upstream version 2.50.1 upstream/2.50.1
authorDongHun Kwak <dh0128.kwak@samsung.com>
Mon, 7 Sep 2020 07:17:20 +0000 (00:17 -0700)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Mon, 7 Sep 2020 07:17:20 +0000 (00:17 -0700)
16 files changed:
MSVC_Net2013/glibmm-install.props
NEWS
configure.ac
examples/thread/dispatcher2.cc
gio/src/action.ccg
gio/src/action.hg
gio/src/actionmap.hg
gio/src/application.hg
gio/src/dbusproxy.hg
gio/src/settingsschemasource.hg
gio/src/simpleaction.hg
glib/glibmm/dispatcher.cc
glib/glibmm/main.cc
glib/glibmm/main.h
glib/src/variant.ccg
glib/src/variant.hg

index 2848409..f28a0c8 100644 (file)
@@ -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 (file)
--- 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.
 
index 671c13e..02352bd 100644 (file)
@@ -15,7 +15,7 @@
 ## You should have received a copy of the GNU Lesser General Public License
 ## along with this library.  If not, see <http://www.gnu.org/licenses/>.
 
-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])
index d56c5e7..9801161 100644 (file)
@@ -85,10 +85,6 @@ ThreadTimer::ThreadTimer()
   signal_increment_.connect(sigc::mem_fun(*this, &ThreadTimer::timer_increment));
 }
 
-ThreadTimer::~ThreadTimer()
-{
-}
-
 void
 ThreadTimer::launch()
 {
index 9dbb598..c5a1735 100644 (file)
@@ -17,8 +17,6 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <glibmm/exceptionhandler.h>
-#include <glibmm/variant.h>
 #include <gio/gio.h>
 
 namespace Gio
index a7ce66e..f05d226 100644 (file)
@@ -18,6 +18,7 @@
 _CONFIGINCLUDE(giommconfig.h)
 
 #include <glibmm/interface.h>
+#include <glibmm/variant.h>
 #include <glibmm/varianttype.h>
 #include <gio/gio.h>
 
@@ -29,13 +30,6 @@ _PINCLUDE(gio/gio.h)
 typedef struct _GActionInterface GActionInterface;
 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
 
-namespace Glib
-{
-
-class VariantBase;
-
-}
-
 namespace Gio
 {
 
index 22241f1..6e59a62 100644 (file)
@@ -53,7 +53,8 @@ public:
   _WRAP_METHOD(Glib::RefPtr<Action> lookup_action(const Glib::ustring& action_name), g_action_map_lookup_action, refreturn)
   _WRAP_METHOD(Glib::RefPtr<const Action> 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<void, const Glib::ustring&>;
 
@@ -160,10 +161,10 @@ public:
   Glib::RefPtr<SimpleAction> 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<void, int>;
 
index 626fa66..f9432ed 100644 (file)
@@ -345,7 +345,7 @@ public:
   /// Unsets any existing default application.
   static void unset_default();
 
-  _WRAP_METHOD(static Glib::RefPtr<Application> get_default(), g_application_get_default)
+  _WRAP_METHOD(static Glib::RefPtr<Application> 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)
index 2e3729f..a6e7419 100644 (file)
@@ -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<InterfaceInfo>& info), g_dbus_proxy_set_interface_info)
index 4097e93..f330945 100644 (file)
@@ -44,7 +44,7 @@ protected:
 
 public:
 
-  _WRAP_METHOD(static Glib::RefPtr<SettingsSchemaSource> get_default(), g_settings_schema_source_get_default)
+  _WRAP_METHOD(static Glib::RefPtr<SettingsSchemaSource> get_default(), g_settings_schema_source_get_default, refreturn)
 
 /* TODO:
 GLIB_AVAILABLE_IN_2_32
index d1e6f23..1c57541 100644 (file)
@@ -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.
index e21914a..d9067a3 100644 (file)
@@ -198,11 +198,11 @@ DispatchNotifier::DispatchNotifier(const Glib::RefPtr<MainContext>& 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);
index d726eba..93ba40e 100644 (file)
@@ -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<bool, IOCondition>& slot, int fd, IOCondition condition, int priority)
+  const sigc::slot<bool, IOCondition>& 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>
-IOSource::create(int fd, IOCondition condition)
+IOSource::create(PollFD::fd_t fd, IOCondition condition)
 {
   return Glib::RefPtr<IOSource>(new IOSource(fd, condition));
 }
@@ -1312,7 +1312,7 @@ IOSource::connect(const sigc::slot<bool, IOCondition>& 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_);
 }
index f60cc8f..c6dc839 100644 (file)
@@ -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<IOCondition>(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<bool, IOCondition>& slot, int fd, IOCondition condition,
+  sigc::connection connect(const sigc::slot<bool, IOCondition>& 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<IOSource> create(int fd, IOCondition condition);
+  static Glib::RefPtr<IOSource> create(PollFD::fd_t fd, IOCondition condition);
   static Glib::RefPtr<IOSource> create(
     const Glib::RefPtr<IOChannel>& channel, IOCondition condition);
   sigc::connection connect(const sigc::slot<bool, IOCondition>& slot);
 
 protected:
-  IOSource(int fd, IOCondition condition);
+  IOSource(PollFD::fd_t fd, IOCondition condition);
   IOSource(const Glib::RefPtr<IOChannel>& channel, IOCondition condition);
 
   /** Wrap an existing GSource object and install the given callback function.
index d70af54..9c47dea 100644 (file)
@@ -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<VariantBase>& children)
   var_ptr* const var_array = new var_ptr[children.size()];
 
   for (std::vector<VariantBase>::size_type i = 0; i < children.size(); i++)
-  {
     var_array[i] = const_cast<GVariant*>(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<VariantContainerBase>(const VariantBase& v) throw(std::bad_cast)
+VariantBase::cast_dynamic<VariantContainerBase>(const VariantBase& v) noexcept(false)
 {
   if (!v.gobj())
-  {
     return VariantContainerBase();
-  }
+
   if (v.get_type().is_container())
   {
     return VariantContainerBase(const_cast<GVariant*>(v.gobj()), true);
@@ -227,7 +221,9 @@ VariantContainerBase::get_maybe(VariantBase& maybe) const
     return true;
   }
   else
+  {
     return false;
+  }
 }
 
 VariantIter
@@ -339,7 +335,7 @@ Variant<Glib::ustring>::get() const
 // See http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-get-string
 template <>
 Variant<Glib::ustring>
-VariantBase::cast_dynamic<Variant<Glib::ustring>>(const VariantBase& v) throw(std::bad_cast)
+VariantBase::cast_dynamic<Variant<Glib::ustring>>(const VariantBase& v) noexcept(false)
 {
   if (!v.gobj())
   {
@@ -388,7 +384,7 @@ Variant<std::string>::create(const std::string& data)
 // See http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-get-string
 template <>
 Variant<std::string>
-VariantBase::cast_dynamic<Variant<std::string>>(const VariantBase& v) throw(std::bad_cast)
+VariantBase::cast_dynamic<Variant<std::string>>(const VariantBase& v) noexcept(false)
 {
   if (!v.gobj())
   {
@@ -456,9 +452,7 @@ Variant<type_vec_ustring>::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<type_vec_ustring>::get() const
   for (gsize i = 0; i < n_children; i++)
   {
     GVariant* gvariant = g_variant_get_child_value(const_cast<GVariant*>(gobj()), i);
-
     result.emplace_back(Glib::Variant<Glib::ustring>(gvariant).get());
   }
 
@@ -534,9 +527,7 @@ Variant<type_vec_string>::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<type_vec_string>::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<type_vec_string>::get() const
   for (gsize i = 0; i < n_children; i++)
   {
     GVariant* gvariant = g_variant_get_child_value(const_cast<GVariant*>(gobj()), i);
-
     result.emplace_back(Glib::Variant<std::string>(gvariant).get());
   }
 
index f855db7..de10195 100644 (file)
@@ -225,7 +225,7 @@ _DEPRECATE_IFDEF_END
     * @throws std::bad_cast if the Variant was not of the expected type.
     */
    template<class V_CastTo>
-   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<class V_CastTo>
 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 <tt>false</tt>.
+  /** If this is a maybe-typed instance, try to extract its value. If there is
+   * no value (the value is <tt>nothing</tt>), return <tt>false</tt. Otherwise,
+   * the value is copied to the supplied Variant and <tt>true</tt> is returned.
    *
-   * @param maybe A place in which to return the value (the value may be
-   * <tt>0</tt>).
+   * @param maybe A place in which to return the value, if it isn’t
+   * <tt>nothing</tt>.
    * @newin{2,28}
    */
   bool get_maybe(VariantBase& maybe) const;
@@ -432,7 +433,7 @@ protected:
 
 template<>
 VariantContainerBase VariantBase::cast_dynamic<VariantContainerBase>(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<Glib::ustring> VariantBase::cast_dynamic< Variant<Glib::ustring> >(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<std::string> VariantBase::cast_dynamic< Variant<std::string> >(const VariantBase& v)
-throw(std::bad_cast);
+noexcept(false);
 
 /** Specialization of Variant containing a dictionary entry.  See also
  * Variant< std::map<K, V> >.
@@ -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<K, V> get() const;
 
   /** Gets a VariantIter of the Variant.
-   * @return the VaraintIter.
+   * @return the VariantIter.
    * @newin{2,28}
    */
   VariantIter get_iter() const;