QDbusTrayIcon: handle open() failure
QDbusTrayIcon has a convoluted workaround/hack that consists in putting an icon file in /tmp/ and then using that path as the icon. Opening the icon file may fail, so handle it. Change-Id: I5d1c681e2fe3cfb23e93fd20f6758d4c83fe1578 Reviewed-by: Dmitry Shachnev <mitya57@gmail.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
9d118af92d
commit
3b186ceef8
@ -198,7 +198,10 @@ QTemporaryFile *QDBusTrayIcon::tempIcon(const QIcon &icon)
|
||||
if (!necessary)
|
||||
return nullptr;
|
||||
QTemporaryFile *ret = new QTemporaryFile(tempFileTemplate(), this);
|
||||
ret->open();
|
||||
if (!ret->open()) {
|
||||
delete ret;
|
||||
return nullptr;
|
||||
}
|
||||
icon.pixmap(QSize(22, 22)).save(ret);
|
||||
ret->close();
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user