[Analyzers][CPP] Turn on warning 26403 (#22795)

This commit is contained in:
sosssego 2023-01-03 09:16:27 -03:00 committed by GitHub
parent dd62dab831
commit 6287460614
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 10 deletions

View File

@ -13,7 +13,7 @@
<Rule Id="C26400" Action="Info" />
<Rule Id="C26401" Action="Info" />
<Rule Id="C26402" Action="Error" />
<Rule Id="C26403" Action="Info" />
<Rule Id="C26403" Action="Error" />
<Rule Id="C26404" Action="Error" />
<Rule Id="C26405" Action="Error" />
<Rule Id="C26406" Action="Error" />

View File

@ -197,13 +197,9 @@ std::unique_ptr<D3DCaptureState> D3DCaptureState::Create(DxgiAPI* dxgiAPI,
swapChain.put()));
// We must create the object in a heap, since we need to pin it in memory to receive callbacks
auto statePtr = new D3DCaptureState{ dxgiAPI,
std::move(swapChain),
pixelFormat,
std::move(monitorInfo),
continuousCapture };
auto statePtr = std::unique_ptr<D3DCaptureState>(new D3DCaptureState{ dxgiAPI, std::move(swapChain), pixelFormat, std::move(monitorInfo), continuousCapture });
return std::unique_ptr<D3DCaptureState>{ statePtr };
return statePtr;
}
D3DCaptureState::~D3DCaptureState()

View File

@ -319,7 +319,14 @@ VideoConferenceModule::VideoConferenceModule()
if (_settingsUpdateChannel)
{
_settingsUpdateChannel->access([](auto memory) {
// Suppress warning 26403 - Reset or explicitly delete an owner<T> pointer 'variable' (r.3)
// the video conference class should be only instantiated once and it is using placement new
// the access to the data can be done through memory._data
#pragma warning(push)
#pragma warning(disable : 26403)
auto updatesChannel = new (memory._data) CameraSettingsUpdateChannel{};
#pragma warning(pop)
});
}
sendSourceCameraNameUpdate();
@ -520,11 +527,11 @@ void VideoConferenceModule::enable()
{
if (!_enabled)
{
_generalSettingsWatcher = std::make_unique<FileWatcher> (
_generalSettingsWatcher = std::make_unique<FileWatcher>(
PTSettingsHelper::get_powertoys_general_save_file_location(), [this] {
toolbar.scheduleGeneralSettingsUpdate();
toolbar.scheduleGeneralSettingsUpdate();
});
_moduleSettingsWatcher = std::make_unique<FileWatcher> (
_moduleSettingsWatcher = std::make_unique<FileWatcher>(
PTSettingsHelper::get_module_save_file_location(get_key()), [this] {
toolbar.scheduleModuleSettingsUpdate();
});