From 29a01bd2d8975b56017caf342c3e651e3fde9417 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 16 Apr 2017 16:53:06 +0200 Subject: [PATCH] CComponentsChannelLogo: use separat var for pic name inside setChannel() picname is a class attribut and should not be touched here till new content exists. Btw. setChannel() is eqiuvalent to setPicture() from base class, so it makes sense to use setPicture() inside setChannel() after picname is known. Explicit call of initCCTitem() is not required. --- src/gui/components/cc_item_picture.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index 2900ceb3a..257586e3c 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -416,6 +416,8 @@ void CComponentsChannelLogo::setAltLogo(const char* picture_name) void CComponentsChannelLogo::setChannel(const uint64_t& channelId, const std::string& channelName) { need_init = true; + string image = pic_name; + if (channelId || !channelName.empty()){ if ((channel_id == channelId) && (channel_name == channelName)) need_init = false; @@ -426,16 +428,16 @@ void CComponentsChannelLogo::setChannel(const uint64_t& channelId, const std::st int dummy; - has_logo = g_PicViewer->GetLogoName(channel_id, channel_name, pic_name, &dummy, &dummy); + has_logo = g_PicViewer->GetLogoName(channel_id, channel_name, image, &dummy, &dummy); if (!has_logo)//no logo was found, use altrenate icon or logo - pic_name = alt_pic_name; + image = alt_pic_name; //if logo or alternate image still not available, set has logo to false - has_logo = !pic_name.empty(); + has_logo = !image.empty(); //refresh object - initCCItem(); + setPicture(image); //set has_logo to false if no dimensions were detected if (width && height)