Skip to content

Commit 88693c6

Browse files
Fix assert in ~DoubleLinkedListEntry (KF-27, #57)
* add tests for DoubleLinkedList * fix assert in list's node dtor
1 parent 5a21482 commit 88693c6

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

include/kf/DoubleLinkedList.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ namespace kf
3636
{
3737
if (this != &other)
3838
{
39+
clear();
40+
3941
if (!other.isEmpty())
4042
{
4143
LIST_ENTRY* next = other.m_head.Flink;

test/DoubleLinkedListTest.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,12 @@ SCENARIO("DoubleLinkedListConstIterator")
282282

283283
SCENARIO("DoubleLinkedListIterator")
284284
{
285-
List list;
286285
TestNode node1{ 1 };
287286
TestNode node2{ 2 };
288287
TestNode node3{ 3 };
289288

289+
List list;
290+
290291
WHEN("iterator is used to modify elements")
291292
{
292293
list.addLast(node1);

0 commit comments

Comments
 (0)