libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
New commits: commit 1016f1f00be268ac1db51b5e295a74d1a5ccba6a Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sat Oct 22 11:27:23 2022 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sat Oct 22 15:10:50 2022 +0200 g_get_real_name is a proper match for passwd::pw_gecos This fixes 66fcc9db0f7eacd0ebda06d9ee634af2d0e73d04. Also nullptr check is added (passing nullptr to std::string ctor taking null-terminated string is UB). GLib implementation: * https://gitlab.gnome.org/GNOME/glib/-/blob/476e33c3f3632bd32370fadc67b10d61da9a4098/glib/gutils.c#L743 * https://gitlab.gnome.org/GNOME/glib/-/blob/476e33c3f3632bd32370fadc67b10d61da9a4098/glib/gutils.c#L577 Change-Id: I4e36cf836f2889f9aa03167c5ade81c69d9b1dfd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141586 Tested-by: Mike Kaganski <mike.kagan...@collabora.com> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit b5acaa1cf36c30ab3cb1a2796ead850598ed233f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141588 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx index 109b0946366a..f2c1e9b9351a 100644 --- a/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx @@ -92,7 +92,9 @@ void GtvHelpers::clipboardSetHtml(GtkClipboard* pClipboard, const char* pSelecti std::string GtvHelpers::getNextAuthor() { static int nCounter = 0; - return std::string(g_get_user_name()) + " #" + std::to_string(++nCounter); + const gchar* pname = g_get_real_name(); + std::string name = pname ? std::string(pname) : std::string(); + return name + " #" + std::to_string(++nCounter); } GtkWidget* GtvHelpers::createCommentBox(const boost::property_tree::ptree& aComment)