kiran-menu/0002-fix-coredump-Fix-the-coredump-problem-caused-by-null.patch
tangjie02 3cf2488e5a Fix the coredump problem caused by nullpointer to UserIcon.
Fix some possible crash problems caused by sigc::slot.

Signed-off-by: tangjie02 <tangjie02@kylinsec.com.cn>
2022-08-09 12:04:08 +08:00

34 lines
1.2 KiB
Diff

From dc5e56b311f49532213a6a6445dc77e1f0cc4661 Mon Sep 17 00:00:00 2001
From: tangjie02 <tangjie02@kylinsec.com.cn>
Date: Tue, 9 Aug 2022 10:49:36 +0800
Subject: [PATCH 2/2] fix(coredump): Fix the coredump problem caused by
nullpointer to UserIcon.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修复由于访问用户图标对象为空导致的崩溃问题
Signed-off-by: tangjie02 <tangjie02@kylinsec.com.cn>
---
src/menu/menu-avatar-widget.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/menu/menu-avatar-widget.cpp b/src/menu/menu-avatar-widget.cpp
index 194a55e..74f8c49 100644
--- a/src/menu/menu-avatar-widget.cpp
+++ b/src/menu/menu-avatar-widget.cpp
@@ -82,7 +82,8 @@ bool MenuAvatarWidget::on_draw(const ::Cairo::RefPtr<Cairo::Context> &cr)
auto radius = image_size / 2.0;
try
{
- pixbuf = Gdk::Pixbuf::create_from_file(user_info.get_iconfile(),
+ auto icon_file = user_info.get_iconfile();
+ pixbuf = Gdk::Pixbuf::create_from_file(icon_file ? icon_file : std::string(),
allocation.get_width() * scale,
allocation.get_height() * scale);
}
--
2.33.0