fixed pasting and removed a mem-leak
This commit is contained in:
parent
9767ad5852
commit
74da2a1c62
@ -1,5 +1,11 @@
|
||||
#include "syncdocument.h"
|
||||
|
||||
SyncDocument::~SyncDocument()
|
||||
{
|
||||
clearUndoStack();
|
||||
clearRedoStack();
|
||||
}
|
||||
|
||||
#import <msxml4.dll> named_guids
|
||||
|
||||
bool SyncDocument::load(const std::string &fileName)
|
||||
|
||||
@ -13,6 +13,7 @@ class SyncDocument : public sync::Data
|
||||
{
|
||||
public:
|
||||
SyncDocument() : sync::Data(), clientPaused(true) {}
|
||||
~SyncDocument();
|
||||
|
||||
void sendSetKeyCommand(int track, int row, const sync::Track::KeyFrame &key)
|
||||
{
|
||||
@ -232,6 +233,16 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
void clearUndoStack()
|
||||
{
|
||||
while (!undoStack.empty())
|
||||
{
|
||||
Command *cmd = undoStack.top();
|
||||
undoStack.pop();
|
||||
delete cmd;
|
||||
}
|
||||
}
|
||||
|
||||
void clearRedoStack()
|
||||
{
|
||||
while (!redoStack.empty())
|
||||
|
||||
@ -242,7 +242,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG);
|
||||
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG);
|
||||
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
|
||||
// _CrtSetBreakAlloc(137);
|
||||
// _CrtSetBreakAlloc(254);
|
||||
#endif
|
||||
|
||||
HINSTANCE hInstance = GetModuleHandle(NULL);
|
||||
|
||||
@ -452,7 +452,9 @@ void TrackView::editPaste()
|
||||
struct CopyEntry ce;
|
||||
memcpy(&ce, src, sizeof(CopyEntry));
|
||||
|
||||
SyncDocument::Command *cmd = document->getSetKeyFrameCommand(editTrack + ce.track, editRow + ce.row, ce.keyFrame);
|
||||
size_t trackIndex = document->getTrackIndexFromPos(editTrack + ce.track);
|
||||
|
||||
SyncDocument::Command *cmd = document->getSetKeyFrameCommand(int(trackIndex), editRow + ce.row, ce.keyFrame);
|
||||
multiCmd->addCommand(cmd);
|
||||
src += sizeof(CopyEntry);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user