Skip to content

Commit

Permalink
refactor(server): use QThreadPool instead of QtConcurrentRun
Browse files Browse the repository at this point in the history
We don't care about the return value, so just send the icon it via the global
thread instance for now. This fixes a clang-tidy check for us as the return
value of QtConcurrent::run is marked as nodiscard.
  • Loading branch information
romangg committed Apr 8, 2023
1 parent 87cf5bc commit 7c2e640
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions server/plasma_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
#include <QIcon>
#include <QList>
#include <QRect>
#include <QThreadPool>
#include <QUuid>
#include <QVector>
#include <QtConcurrentRun>

#include <cassert>
#include <csignal>
Expand Down Expand Up @@ -839,15 +839,13 @@ void PlasmaWindowRes::Private::getIconCallback([[maybe_unused]] wl_client* wlCli
if (!priv->window) {
return;
}
QtConcurrent::run(
[fd](QIcon const& icon) {
QFile file;
file.open(fd, QIODevice::WriteOnly, QFileDevice::AutoCloseHandle);
QDataStream ds(&file);
ds << icon;
file.close();
},
priv->window->d_ptr->m_icon);
QThreadPool::globalInstance()->start([fd, icon = priv->window->d_ptr->m_icon] {
QFile file;
file.open(fd, QIODevice::WriteOnly, QFileDevice::AutoCloseHandle);
QDataStream ds(&file);
ds << icon;
file.close();
});
}

void PlasmaWindowRes::Private::requestEnterVirtualDesktopCallback(
Expand Down

0 comments on commit 7c2e640

Please sign in to comment.