Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix memory leak: live_player_activity: re call the fn showDialog #330

Merged
merged 10 commits into from
May 3, 2024
14 changes: 0 additions & 14 deletions wiliwili/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,7 @@
#include <SDL2/SDL_main.h>
#endif

#ifdef _WIN32
#include <winsock2.h>
#endif

int main(int argc, char* argv[]) {
#ifdef _WIN32
WSADATA wsaData;
int result = WSAStartup(MAKEWORD(2, 2), &wsaData);
if (result != 0) {
printf("WSAStartup failed with error: %d\n", result);
}
#endif
for (int i = 1; i < argc; i++) {
if (std::strcmp(argv[i], "-d") == 0) {
brls::Logger::setLogLevel(brls::LogLevel::LOG_DEBUG);
Expand Down Expand Up @@ -116,9 +105,6 @@ int main(int argc, char* argv[]) {
// Cleanup curl and Check whether restart is required
ProgramConfig::instance().exit(argv);

#ifdef _WIN32
WSACleanup();
#endif
// Exit
return EXIT_SUCCESS;
}
Expand Down
14 changes: 14 additions & 0 deletions wiliwili/source/utils/config_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ extern in_addr_t secondary_dns;
}
#endif

#ifdef _WIN32
#include <winsock2.h>
#endif

#ifndef PATH_MAX
#define PATH_MAX 256
#endif
Expand Down Expand Up @@ -717,6 +721,13 @@ void ProgramConfig::init() {
curl_global_init(CURL_GLOBAL_DEFAULT);
cpr::async::startup(THREAD_POOL_MIN_THREAD_NUM, THREAD_POOL_MAX_THREAD_NUM, std::chrono::milliseconds(5000));

#ifdef _WIN32
WSADATA wsaData;
int result = WSAStartup(MAKEWORD(2, 2), &wsaData);
if (result != 0) {
printf("WSAStartup failed with error: %d\n", result);
Copy link
Owner

@xfangfang xfangfang May 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

抱歉,再提一个点,可以把这里的 printf 换成 brls::Logger::error 嘛?万一真的出错了,用brls::Logger可以记录下log来


brls::Logger::error("WSAStartup failed with error: {}", result); 

}
#endif
#if defined(_MSC_VER)
#elif defined(__PSV__)
#elif defined(PS4)
Expand Down Expand Up @@ -843,6 +854,9 @@ void ProgramConfig::exit(char* argv[]) {
cpr::async::cleanup();
curl_global_cleanup();

#ifdef _WIN32
WSACleanup();
#endif
#ifdef IOS
#elif defined(PS4)
#elif __PSV__
Expand Down