mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[external] Fixed memory leak #454
This commit is contained in:
@@ -33,9 +33,20 @@ void AppCell::layoutSubviews(bool force) {
|
||||
m_nameView.setFrame(KDRect((bounds().width()-nameSize.width())/2-k_nameWidthMargin, bounds().height()-nameSize.height() - 2*k_nameHeightMargin, nameSize.width()+2*k_nameWidthMargin, nameSize.height()+2*k_nameHeightMargin), force);
|
||||
}
|
||||
|
||||
void AppCell::setExtAppDescriptor(const char* name, const uint8_t *icon, size_t iconLength) {
|
||||
m_external_app = true;
|
||||
m_iconView.setImage(icon, iconLength);
|
||||
m_iconView.setImage(nullptr);
|
||||
m_nameView.setText(name);
|
||||
m_nameView.setTextColor(Palette::HomeCellTextExternal);
|
||||
m_nameView.setMessage(I18n::Message::Default);
|
||||
layoutSubviews();
|
||||
}
|
||||
|
||||
void AppCell::setExtAppDescriptor(const char* name, const Image* icon) {
|
||||
m_external_app = true;
|
||||
m_iconView.setImage(icon);
|
||||
m_iconView.setImage(nullptr, 0);
|
||||
m_nameView.setText(name);
|
||||
m_nameView.setTextColor(Palette::HomeCellTextExternal);
|
||||
m_nameView.setMessage(I18n::Message::Default);
|
||||
@@ -45,6 +56,7 @@ void AppCell::setExtAppDescriptor(const char* name, const Image* icon) {
|
||||
void AppCell::setAppDescriptor(::App::Descriptor * descriptor) {
|
||||
m_external_app = false;
|
||||
m_iconView.setImage(descriptor->icon());
|
||||
m_iconView.setImage(nullptr, 0);
|
||||
m_nameView.setMessage(descriptor->name());
|
||||
m_nameView.setTextColor(Palette::HomeCellText);
|
||||
m_nameView.setText(nullptr);
|
||||
|
||||
@@ -18,6 +18,7 @@ public:
|
||||
void reloadCell() override;
|
||||
void setAppDescriptor(::App::Descriptor * appDescriptor);
|
||||
void setExtAppDescriptor(const char* name, const Image* icon);
|
||||
void setExtAppDescriptor(const char* name, const uint8_t *icon, size_t iconLength);
|
||||
private:
|
||||
static constexpr KDCoordinate k_iconMargin = 22;
|
||||
static constexpr KDCoordinate k_iconWidth = 55;
|
||||
|
||||
@@ -189,9 +189,8 @@ void Controller::willDisplayCellAtLocation(HighlightCell * cell, int i, int j) {
|
||||
if (img_index != -1) {
|
||||
External::Archive::File image_file;
|
||||
if (External::Archive::fileAtIndex(img_index, image_file)) {
|
||||
const Image* img = new Image(55, 56, image_file.data, image_file.dataLength);
|
||||
appCell->setExtAppDescriptor(app_file.name, img);
|
||||
|
||||
// const Image* img = new Image(55, 56, image_file.data, image_file.dataLength);
|
||||
appCell->setExtAppDescriptor(app_file.name, image_file.data, image_file.dataLength);
|
||||
} else {
|
||||
appCell->setExtAppDescriptor(app_file.name, ImageStore::ExternalIcon);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user