summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2024-03-22 17:23:22 +0100
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2024-03-26 21:31:53 +0000
commit3b186ceef81e233fcaab94a10c98a582c27cfcfd (patch)
tree8389cec4b4b787cff41dcaf2d48079f678033460 /src/gui
parent9d118af92db4a522c8b495c273be4780a5265c12 (diff)
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>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/platform/unix/dbustray/qdbustrayicon.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/platform/unix/dbustray/qdbustrayicon.cpp b/src/gui/platform/unix/dbustray/qdbustrayicon.cpp
index 5be223b510..0dff9b598e 100644
--- a/src/gui/platform/unix/dbustray/qdbustrayicon.cpp
+++ b/src/gui/platform/unix/dbustray/qdbustrayicon.cpp
@@ -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;