aboutsummaryrefslogtreecommitdiffhomepage
path: root/qbuffers.h
diff options
context:
space:
mode:
Diffstat (limited to 'qbuffers.h')
-rw-r--r--qbuffers.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/qbuffers.h b/qbuffers.h
index 49b2872..9f22ab1 100644
--- a/qbuffers.h
+++ b/qbuffers.h
@@ -143,6 +143,7 @@ class Buffer {
run(void)
{
buffer->close();
+ /* NOTE: the buffer is NOT deleted on Token destruction */
delete buffer;
}
};
@@ -168,7 +169,7 @@ public:
g_free(filename);
}
- inline Buffer *
+ inline Buffer *&
next(void)
{
return LIST_NEXT(this, buffers);
@@ -206,6 +207,26 @@ public:
};
extern class Ring {
+ /*
+ * Emitted after a buffer close
+ * The pointer is the only remaining reference to the buffer!
+ */
+ class UndoTokenEdit : public UndoToken {
+ Ring *ring;
+ Buffer *buffer;
+
+ public:
+ UndoTokenEdit(Ring *_ring, Buffer *_buffer)
+ : UndoToken(), ring(_ring), buffer(_buffer) {}
+ ~UndoTokenEdit()
+ {
+ if (buffer)
+ delete buffer;
+ }
+
+ void run(void);
+ };
+
LIST_HEAD(Head, Buffer) head;
public: