Fix a possible use after free
Found by coverity. The cachedIcon can be deleted when being inserted into the icon cache (in QCache::insert). So copy it to icon before trying to insert it into the cache. Change-Id: I5ed13c0c7ecb8f8f13285ca5d06237493dbea479 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
This commit is contained in:
parent
848d29cca3
commit
1487a93e46
@ -1173,8 +1173,8 @@ QIcon QIcon::fromTheme(const QString &name, const QIcon &fallback)
|
||||
QIconEngine * const engine = platformTheme ? platformTheme->createIconEngine(name)
|
||||
: new QIconLoaderEngine(name);
|
||||
QIcon *cachedIcon = new QIcon(engine);
|
||||
qtIconCache()->insert(name, cachedIcon);
|
||||
icon = *cachedIcon;
|
||||
qtIconCache()->insert(name, cachedIcon);
|
||||
}
|
||||
|
||||
// Note the qapp check is to allow lazy loading of static icons
|
||||
|
Loading…
Reference in New Issue
Block a user