Skip to content

Commit

Permalink
use ComPtr in gui_context_menus.h (shadps4-emu#719)
Browse files Browse the repository at this point in the history
* use ComPtr in gui_context_menus.h

* fix pragma diagnostic

* fix compiler warnings
  • Loading branch information
oltolm authored Sep 25, 2024
1 parent 45e206e commit 5a4d5b9
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 29 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ FodyWeavers.xsd
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
/CMakeUserPresets.json
/compile_commands.json

# Local History for Visual Studio Code
.history/
Expand All @@ -409,6 +411,6 @@ FodyWeavers.xsd
/out/*
/third-party/out/*
/src/common/scm_rev.cpp


# for macOS
**/.DS_Store
**/.DS_Store
2 changes: 1 addition & 1 deletion src/core/libraries/np_trophy/trophy_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ void TrophyUI::Draw() {
End();
}
}
}
}
4 changes: 2 additions & 2 deletions src/qt_gui/cheats_patches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ void CheatsPatches::downloadPatches(const QString repository, const bool showMes
request.setRawHeader("Accept", "application/vnd.github.v3+json");
QNetworkReply* reply = manager->get(request);

connect(reply, &QNetworkReply::finished, [=]() {
connect(reply, &QNetworkReply::finished, [=, this]() {
if (reply->error() == QNetworkReply::NoError) {
QByteArray jsonData = reply->readAll();
reply->deleteLater();
Expand Down Expand Up @@ -712,7 +712,7 @@ void CheatsPatches::downloadPatches(const QString repository, const bool showMes
QNetworkRequest fileRequest(downloadUrl);
QNetworkReply* fileReply = manager->get(fileRequest);

connect(fileReply, &QNetworkReply::finished, [=]() {
connect(fileReply, &QNetworkReply::finished, [=, this]() {
if (fileReply->error() == QNetworkReply::NoError) {
QByteArray fileData = fileReply->readAll();
QFile localFile(dir.filePath(fileName));
Expand Down
11 changes: 5 additions & 6 deletions src/qt_gui/gui_context_menus.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <objbase.h>
#include <shlguid.h>
#include <shobjidl.h>
#include <wrl/client.h>
#endif
#include "common/path_util.h"

Expand Down Expand Up @@ -342,9 +343,9 @@ class GuiContextMenus : public QObject {
CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);

// Create the ShellLink object
IShellLink* pShellLink = nullptr;
Microsoft::WRL::ComPtr<IShellLink> pShellLink;
HRESULT hres = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER,
IID_IShellLink, (LPVOID*)&pShellLink);
IID_PPV_ARGS(&pShellLink));
if (SUCCEEDED(hres)) {
// Defines the path to the program executable
pShellLink->SetPath((LPCWSTR)exePath.utf16());
Expand All @@ -360,13 +361,11 @@ class GuiContextMenus : public QObject {
pShellLink->SetIconLocation((LPCWSTR)iconPath.utf16(), 0);

// Save the shortcut
IPersistFile* pPersistFile = nullptr;
hres = pShellLink->QueryInterface(IID_IPersistFile, (LPVOID*)&pPersistFile);
Microsoft::WRL::ComPtr<IPersistFile> pPersistFile;
hres = pShellLink.As(&pPersistFile);
if (SUCCEEDED(hres)) {
hres = pPersistFile->Save((LPCWSTR)linkPath.utf16(), TRUE);
pPersistFile->Release();
}
pShellLink->Release();
}

CoUninitialize();
Expand Down
3 changes: 0 additions & 3 deletions src/video_core/buffer_cache/buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
#include "video_core/renderer_vulkan/vk_platform.h"
#include "video_core/renderer_vulkan/vk_scheduler.h"

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnullability-completeness"
#include <vk_mem_alloc.h>
#pragma GCC diagnostic pop

namespace VideoCore {

Expand Down
3 changes: 0 additions & 3 deletions src/video_core/renderer_vulkan/renderer_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@
#include "video_core/renderer_vulkan/vk_rasterizer.h"
#include "video_core/texture_cache/image.h"

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnullability-completeness"
#include <vk_mem_alloc.h>
#pragma GCC diagnostic pop

namespace Vulkan {

Expand Down
6 changes: 3 additions & 3 deletions src/video_core/renderer_vulkan/vk_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

// Implement vma functions
#define VMA_IMPLEMENTATION
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnullability-completeness"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnullability-completeness"
#include <vk_mem_alloc.h>
#pragma GCC diagnostic pop
#pragma clang diagnostic pop

// Store the dispatch loader here
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
3 changes: 0 additions & 3 deletions src/video_core/renderer_vulkan/vk_instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
#include "video_core/renderer_vulkan/vk_instance.h"
#include "video_core/renderer_vulkan/vk_platform.h"

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnullability-completeness"
#include <vk_mem_alloc.h>
#pragma GCC diagnostic pop

namespace Vulkan {

Expand Down
3 changes: 0 additions & 3 deletions src/video_core/texture_cache/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
#include "video_core/renderer_vulkan/vk_scheduler.h"
#include "video_core/texture_cache/image.h"

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnullability-completeness"
#include <vk_mem_alloc.h>
#pragma GCC diagnostic pop

namespace VideoCore {

Expand Down
3 changes: 0 additions & 3 deletions src/video_core/texture_cache/tile_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@

#include <boost/container/static_vector.hpp>
#include <magic_enum.hpp>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnullability-completeness"
#include <vk_mem_alloc.h>
#pragma GCC diagnostic pop

namespace VideoCore {

Expand Down

0 comments on commit 5a4d5b9

Please sign in to comment.