[gtkmm] Gdk::TimeCoord: Don't use the deprecated g_memdup()
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Gdk::TimeCoord: Don't use the deprecated g_memdup()
- Date: Tue, 16 Feb 2021 08:59:44 +0000 (UTC)
commit b8f767f563f91ef70093afc064a33ef09a292313
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Tue Feb 16 09:58:08 2021 +0100
Gdk::TimeCoord: Don't use the deprecated g_memdup()
gdk/src/timecoord.ccg | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gdk/src/timecoord.ccg b/gdk/src/timecoord.ccg
index b25464c7..dde34bb4 100644
--- a/gdk/src/timecoord.ccg
+++ b/gdk/src/timecoord.ccg
@@ -23,8 +23,14 @@ namespace
inline GdkTimeCoord* time_coord_copy(const GdkTimeCoord* gobject)
{
- // If gobject == nullptr, g_memdup() returns nullptr.
- return static_cast<GdkTimeCoord*>(g_memdup(gobject, sizeof(GdkTimeCoord)));
+ // Don't use g_memdup(). It's deprecated in glib 2.67.3.
+ // Its replacement, g_memdup2(), is new in glib 2.67.3.
+ if (!gobject)
+ return nullptr;
+
+ GdkTimeCoord* new_obj = g_new(GdkTimeCoord, 1);
+ *new_obj = *gobject;
+ return new_obj;
}
} // anonymous namespace
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]