From 0f158ac6d2d965f579e3118bbc2ce808ffa39dd6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Mar 2023 22:54:37 +0100 Subject: [PATCH] Replace wxScopedPtr with std::unique_ptr in wxOSX Stop using wxScopedPtr in wxOSX and use the standard class instead: there were just a few occurrences of the former in this port, so it was easy to get rid of it. --- src/osx/carbon/dataobj.cpp | 4 +++- src/osx/cocoa/taskbar.mm | 5 +++-- src/osx/core/utilsexc_cf.cpp | 4 +++- src/osx/menu_osx.cpp | 5 +++-- src/osx/nonownedwnd_osx.cpp | 4 ++-- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/osx/carbon/dataobj.cpp b/src/osx/carbon/dataobj.cpp index 8d0998f8fc..e233f5d1c9 100644 --- a/src/osx/carbon/dataobj.cpp +++ b/src/osx/carbon/dataobj.cpp @@ -32,6 +32,8 @@ #include "wx/osx/private.h" #include "wx/osx/private/datatransfer.h" +#include + static CFStringRef kUTTypeTraditionalMacText = CFSTR("com.apple.traditional-mac-plain-text"); static wxString privateUTIPrefix = "org.wxwidgets.private."; @@ -423,7 +425,7 @@ bool wxDataObject::ReadFromSource(wxOSXDataSource * source) for ( size_t itemIndex = 0; itemIndex < itemCount && !transferred; ++itemIndex) { - wxScopedPtr sitem(source->GetItem(itemIndex)); + std::unique_ptr sitem(source->GetItem(itemIndex)); wxDataFormat::NativeFormat nativeFormat = sitem->AvailableType(typesarray); CFDataRef flavorData = sitem->DoGetData(nativeFormat); diff --git a/src/osx/cocoa/taskbar.mm b/src/osx/cocoa/taskbar.mm index d3a0707ac8..a18b62c52c 100644 --- a/src/osx/cocoa/taskbar.mm +++ b/src/osx/cocoa/taskbar.mm @@ -19,11 +19,12 @@ #include "wx/dcclient.h" #endif -#include "wx/scopedptr.h" #include "wx/taskbar.h" #include "wx/osx/private.h" +#include + class wxTaskBarIconWindow; //----------------------------------------------------------------------------- @@ -105,7 +106,7 @@ protected: private: wxTaskBarIconDockImpl(); wxMenu *m_pMenu; - wxScopedPtr m_menuDeleter; + std::unique_ptr m_menuDeleter; }; class wxTaskBarIconCustomStatusItemImpl; diff --git a/src/osx/core/utilsexc_cf.cpp b/src/osx/core/utilsexc_cf.cpp index 71fc01a0c9..0dd9d2f3f6 100644 --- a/src/osx/core/utilsexc_cf.cpp +++ b/src/osx/core/utilsexc_cf.cpp @@ -31,6 +31,8 @@ #if wxUSE_EVENTLOOP_SOURCE +#include + namespace { @@ -76,7 +78,7 @@ public: { wxCHECK_MSG( fd != -1, nullptr, "can't monitor invalid fd" ); - wxScopedPtr + std::unique_ptr source(new wxCFEventLoopSource(handler, flags)); CFSocketContext context = { 0, source.get(), nullptr, nullptr, nullptr }; diff --git a/src/osx/menu_osx.cpp b/src/osx/menu_osx.cpp index 8729a74acd..7e316d6b61 100644 --- a/src/osx/menu_osx.cpp +++ b/src/osx/menu_osx.cpp @@ -31,13 +31,14 @@ #endif #include "wx/osx/private.h" -#include "wx/scopedptr.h" #include "wx/private/menuradio.h" // for wxMenuRadioItemsData // other standard headers // ---------------------- #include +#include + wxIMPLEMENT_ABSTRACT_CLASS(wxMenuImpl, wxObject); wxMenuImpl::~wxMenuImpl() @@ -47,7 +48,7 @@ wxMenuImpl::~wxMenuImpl() // the (popup) menu title has this special menuid static const int idMenuTitle = -3; -wxScopedPtr gs_emptyMenuBar; +std::unique_ptr gs_emptyMenuBar; // ============================================================================ // implementation diff --git a/src/osx/nonownedwnd_osx.cpp b/src/osx/nonownedwnd_osx.cpp index 2781cbd70f..407c10bab0 100644 --- a/src/osx/nonownedwnd_osx.cpp +++ b/src/osx/nonownedwnd_osx.cpp @@ -533,7 +533,7 @@ bool wxNonOwnedWindow::DoSetRegionShape(const wxRegion& region) #if wxUSE_GRAPHICS_CONTEXT -#include "wx/scopedptr.h" +#include bool wxNonOwnedWindow::DoSetPathShape(const wxGraphicsPath& path) { @@ -547,7 +547,7 @@ bool wxNonOwnedWindow::DoSetPathShape(const wxGraphicsPath& path) dc.SetBackground(*wxBLACK_BRUSH); dc.Clear(); - wxScopedPtr context(wxGraphicsContext::Create(dc)); + std::unique_ptr context(wxGraphicsContext::Create(dc)); context->SetBrush(*wxWHITE_BRUSH); context->SetAntialiasMode(wxANTIALIAS_NONE); context->FillPath(path);