From 0b918a748af6b9e0904db6a67b74e880035cd4a9 Mon Sep 17 00:00:00 2001 From: Morc - Richard Gráčik Date: Fri, 21 Jul 2023 20:13:08 +0200 Subject: keep aspect ratio for LazyImage --- src/components/lazyimage.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/lazyimage.cpp b/src/components/lazyimage.cpp index 13bd65d..90b8f28 100644 --- a/src/components/lazyimage.cpp +++ b/src/components/lazyimage.cpp @@ -39,7 +39,9 @@ bool LazyImage::OnDraw(const Cairo::RefPtr &context) { Abaddon::Get().GetImageManager().LoadAnimationFromURL(m_url, m_width, m_height, sigc::track_obj(cb, *this)); } else { auto cb = [this](const Glib::RefPtr &pb) { - property_pixbuf() = pb->scale_simple(m_width, m_height, Gdk::INTERP_BILINEAR); + int cw, ch; + GetImageDimensions(pb->get_width(), pb->get_height(), cw, ch, m_width, m_height); + property_pixbuf() = pb->scale_simple(cw, ch, Gdk::INTERP_BILINEAR); }; Abaddon::Get().GetImageManager().LoadFromURL(m_url, sigc::track_obj(cb, *this)); -- cgit v1.2.3 From 22025c2f0d13e4a4179cc7bc88a854fc4ab2105e Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Tue, 25 Jul 2023 15:56:22 -0400 Subject: fix regex reading from freed memory (fixes #197) --- src/components/chatmessage.cpp | 3 ++- src/startup.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/chatmessage.cpp b/src/components/chatmessage.cpp index 23ee36f..d1d9f72 100644 --- a/src/components/chatmessage.cpp +++ b/src/components/chatmessage.cpp @@ -204,7 +204,8 @@ void ChatMessageItemContainer::UpdateTextComponent(Gtk::TextView *tv) { if (data->Application.has_value()) { static const auto regex = Glib::Regex::create(R"()"); Glib::MatchInfo match; - if (regex->match(data->Content, match)) { + Glib::ustring string = data->Content; + if (regex->match(string, match)) { const auto cmd = match.fetch(1); const auto app = data->Application->Name; b->insert_markup(s, "used " + cmd + " with " + app + ""); diff --git a/src/startup.cpp b/src/startup.cpp index 6d1ac96..06d6402 100644 --- a/src/startup.cpp +++ b/src/startup.cpp @@ -54,7 +54,8 @@ std::optional GetBuildNumberFromJSURL(const Glib::ustring &url, const auto regex = Glib::Regex::create(R"("buildNumber",null!==\(t="(\d+)\"\))"); Glib::MatchInfo match; - if (regex->match(res.text, match)) { + Glib::ustring string = res.text; + if (regex->match(string, match)) { const auto str_value = match.fetch(1); try { return std::stoul(str_value); -- cgit v1.2.3