From 29200089d2728b320d9862758ce2493e80116549 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 20 Nov 2016 16:37:33 +0100 Subject: fixup to 19675a1a4899: fixed crash after rubbing out creation of global register * test case: rubout 1U[foo] * this probably also leaked memory if it didn't crash * a missing cast from RBTree::remove() was missing. This cast is necessary since QRegister uses multiple inheritance. The offset of RBEntryString might not be 0 in QRegister. Also, since the base class is no longer virtual, a cast to the virtual QRegister class is necessary to ensure that subclass destructors get called. This might have not caused problems before since RBEntry was virtual or the compiler just happened to reorder the instance structures. --- src/qregisters.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/qregisters.h b/src/qregisters.h index ef06458..bcea2f2 100644 --- a/src/qregisters.h +++ b/src/qregisters.h @@ -301,7 +301,7 @@ class QRegisterTable : private RBTreeString { void run(void) { - delete table->remove(reg); + delete (QRegister *)table->remove(reg); } }; -- cgit v1.2.3