mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 16:10:06 +02:00
Bug2436: Cross-project paste should duplicate block files...
... to avoid data loss! Bug caused by commit c2feee6
This commit is contained in:
parent
c6765efa89
commit
ecb65f8c2b
@ -400,7 +400,7 @@ DirManager::DirManager()
|
||||
srand(time(NULL));
|
||||
|
||||
// Set up local temp subdir
|
||||
// Previously, Audacity just named project temp directories "project0",
|
||||
// Previously, Audacity just na med project temp directories "project0",
|
||||
// "project1" and so on. But with the advent of recovery code, we need a
|
||||
// unique name even after a crash. So we create a random project index
|
||||
// and make sure it is not used already. This will not pose any performance
|
||||
|
@ -530,10 +530,12 @@ void WaveTrack::Trim (double t0, double t1)
|
||||
|
||||
|
||||
|
||||
WaveTrack::Holder WaveTrack::EmptyCopy() const
|
||||
WaveTrack::Holder WaveTrack::EmptyCopy(
|
||||
const std::shared_ptr<DirManager> &pDirManager ) const
|
||||
{
|
||||
auto result = std::make_shared<WaveTrack>( mDirManager, mFormat, mRate );
|
||||
result->Init(*this);
|
||||
result->mDirManager = pDirManager ? pDirManager : mDirManager;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,8 @@ private:
|
||||
|
||||
// Make another track copying format, rate, color, etc. but containing no
|
||||
// clips
|
||||
Holder EmptyCopy() const;
|
||||
Holder EmptyCopy(
|
||||
const std::shared_ptr<DirManager> &pDirManager = {} ) const;
|
||||
|
||||
// If forClipboard is true,
|
||||
// and there is no clip at the end time of the selection, then the result
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "../AdornedRulerPanel.h"
|
||||
#include "../Clipboard.h"
|
||||
#include "../CommonCommandFlags.h"
|
||||
#include "../DirManager.h"
|
||||
#include "../LabelTrack.h"
|
||||
#include "../Menus.h"
|
||||
#include "../NoteTrack.h"
|
||||
@ -75,6 +76,7 @@ bool DoPasteText(AudacityProject &project)
|
||||
bool DoPasteNothingSelected(AudacityProject &project)
|
||||
{
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &dirManager = DirManager::Get( project );
|
||||
auto &trackFactory = TrackFactory::Get( project );
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
auto &window = ProjectWindow::Get( project );
|
||||
@ -101,7 +103,7 @@ bool DoPasteNothingSelected(AudacityProject &project)
|
||||
// Cause duplication of block files on disk, when copy is
|
||||
// between projects
|
||||
locker.emplace(wc);
|
||||
uNewTrack = wc->EmptyCopy();
|
||||
uNewTrack = wc->EmptyCopy( dirManager.shared_from_this() );
|
||||
pNewTrack = uNewTrack.get();
|
||||
},
|
||||
#ifdef USE_MIDI
|
||||
@ -379,6 +381,7 @@ void OnPaste(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &dirManager = DirManager::Get( project );
|
||||
auto &trackFactory = TrackFactory::Get( project );
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
const auto &settings = ProjectSettings::Get( project );
|
||||
@ -596,7 +599,7 @@ void OnPaste(const CommandContext &context)
|
||||
wt->ClearAndPaste(t0, t1, wc, true, true);
|
||||
}
|
||||
else {
|
||||
auto tmp = wt->EmptyCopy();
|
||||
auto tmp = wt->EmptyCopy( dirManager.shared_from_this() );
|
||||
tmp->InsertSilence( 0.0,
|
||||
// MJS: Is this correct?
|
||||
clipboard.Duration() );
|
||||
|
Loading…
x
Reference in New Issue
Block a user