mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-17 14:08:03 -06:00
Don't use explicit memory management
And avoid dangling pointers.
This commit is contained in:
@@ -31,6 +31,8 @@
|
||||
#include <optional>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <memory>
|
||||
|
||||
#include <windows.h>
|
||||
#include <powrprof.h>
|
||||
#include <Shlobj.h>
|
||||
@@ -393,7 +395,7 @@ QString Utils::Misc::getUserIDString()
|
||||
const int UNLEN = 256;
|
||||
WCHAR buffer[UNLEN + 1] = {0};
|
||||
DWORD buffer_len = sizeof(buffer) / sizeof(*buffer);
|
||||
if (GetUserNameW(buffer, &buffer_len))
|
||||
if (::GetUserNameW(buffer, &buffer_len))
|
||||
uid = QString::fromWCharArray(buffer);
|
||||
#else
|
||||
uid = QString::number(getuid());
|
||||
|
||||
Reference in New Issue
Block a user