mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-03 06:02:29 -06:00
Merge pull request #17116 from Chocobo1/cleanup
Clean up usage of `static` keyword
This commit is contained in:
@@ -43,7 +43,6 @@
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#include <QAtomicInt>
|
||||
#include <QByteArray>
|
||||
#include <QDebug>
|
||||
#include <QLibraryInfo>
|
||||
@@ -808,8 +807,7 @@ void Application::applyMemoryWorkingSetLimit()
|
||||
void Application::cleanup()
|
||||
{
|
||||
// cleanup() can be called multiple times during shutdown. We only need it once.
|
||||
static QAtomicInt alreadyDone;
|
||||
if (!alreadyDone.testAndSetAcquire(0, 1))
|
||||
if (!m_isCleanupRun.testAndSetAcquire(0, 1))
|
||||
return;
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QAtomicInt>
|
||||
#include <QCoreApplication>
|
||||
#include <QPointer>
|
||||
#include <QStringList>
|
||||
@@ -145,6 +146,7 @@ private:
|
||||
|
||||
ApplicationInstanceManager *m_instanceManager = nullptr;
|
||||
bool m_running = false;
|
||||
QAtomicInt m_isCleanupRun;
|
||||
ShutdownDialogAction m_shutdownAct;
|
||||
QBtCommandLineParameters m_commandLineArgs;
|
||||
|
||||
|
||||
@@ -76,8 +76,8 @@ namespace
|
||||
{
|
||||
const size_t strLen = strlen(str);
|
||||
#ifdef Q_OS_WIN
|
||||
if (_write(_fileno(stderr), str, strLen) < static_cast<int>(strLen))
|
||||
std::ignore = _write(_fileno(stdout), str, strLen);
|
||||
if (_write(_fileno(stderr), str, static_cast<unsigned int>(strLen)) < static_cast<int>(strLen))
|
||||
std::ignore = _write(_fileno(stdout), str, static_cast<unsigned int>(strLen));
|
||||
#else
|
||||
if (write(STDERR_FILENO, str, strLen) < static_cast<ssize_t>(strLen))
|
||||
std::ignore = write(STDOUT_FILENO, str, strLen);
|
||||
|
||||
Reference in New Issue
Block a user