mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-21 23:00:06 +02:00
shared_ptr manages AudacityProject objects, so weak_ptr may be used
This commit is contained in:
parent
3c4ac1861c
commit
5752dbab02
@ -526,14 +526,16 @@ AudacityProject *CreateNewAudacityProject()
|
||||
bool bIconized;
|
||||
GetNextWindowPlacement(&wndRect, &bMaximized, &bIconized);
|
||||
|
||||
//Create and show a NEW project
|
||||
gAudacityProjects.push_back(
|
||||
make_movable_with_deleter<AudacityProject, Destroyer< AudacityProject > >
|
||||
({},
|
||||
nullptr, -1,
|
||||
wxDefaultPosition,
|
||||
wxSize(wndRect.width, wndRect.height))
|
||||
);
|
||||
// Create and show a NEW project
|
||||
// Use a non-default deleter in the smart pointer!
|
||||
gAudacityProjects.push_back( AProjectHolder {
|
||||
safenew AudacityProject(
|
||||
nullptr, -1,
|
||||
wxDefaultPosition,
|
||||
wxSize(wndRect.width, wndRect.height)
|
||||
),
|
||||
Destroyer< AudacityProject > {}
|
||||
} );
|
||||
const auto p = gAudacityProjects.back().get();
|
||||
|
||||
// wxGTK3 seems to need to require creating the window using default position
|
||||
|
@ -110,8 +110,8 @@ void GetDefaultWindowRect(wxRect *defRect);
|
||||
void GetNextWindowPlacement(wxRect *nextRect, bool *pMaximized, bool *pIconized);
|
||||
bool IsWindowAccessible(wxRect *requestedRect);
|
||||
|
||||
using AProjectHolder =
|
||||
movable_ptr_with_deleter< AudacityProject, Destroyer< AudacityProject > >;
|
||||
// Use shared_ptr to projects, because elsewhere we need weak_ptr
|
||||
using AProjectHolder = std::shared_ptr< AudacityProject >;
|
||||
using AProjectArray = std::vector< AProjectHolder >;
|
||||
|
||||
extern AProjectArray gAudacityProjects;
|
||||
|
Loading…
x
Reference in New Issue
Block a user