ProjectJournal: cap the number of undo states to prevent infinite memory buildup

The cap is hardcoded to 100 for now, TODO: make this number configurable (or even better: use a max. memory amount instead of max number of states)
This commit is contained in:
Vesa
2014-07-10 14:22:40 +03:00
parent a82bcb1759
commit 4855634bf4
2 changed files with 11 additions and 4 deletions

View File

@@ -22,8 +22,8 @@
*
*/
#ifndef _PROJECT_JOURNAL_H
#define _PROJECT_JOURNAL_H
#ifndef PROJECT_JOURNAL_H
#define PROJECT_JOURNAL_H
#include <QtCore/QHash>
#include <QtCore/QStack>
@@ -37,6 +37,8 @@ class JournallingObject;
class ProjectJournal
{
public:
static const int MAX_UNDO_STATES;
ProjectJournal();
virtual ~ProjectJournal();
@@ -88,7 +90,7 @@ private:
struct CheckPoint
{
CheckPoint( jo_id_t initID = 0, const DataFile&initData = DataFile( DataFile::JournalData ) ) :
CheckPoint( jo_id_t initID = 0, const DataFile& initData = DataFile( DataFile::JournalData ) ) :
joID( initID ),
data( initData )
{