Commit 385b7f62 by xiaotong

bug fix in XLink::Replace

parent 863f4585
......@@ -45,11 +45,11 @@ int main( int argc, const char ** argv )
//_CrtSetBreakAlloc(123);
/* a tiny test */
if(false)
if(true)
SmallTest();
//_CrtDumpMemoryLeaks();
//return 0;
return 0;
if(argc > 1 && !strcmp(argv[1], "-test"))
Test();
......
......@@ -112,6 +112,8 @@ void XLink::ClearOutgoing(XTensor * node)
}
outgo.ClearTail();
outgo.typeID = 0;
outgo.type[0] = 0;
}
/*
......@@ -148,6 +150,8 @@ void XLink::ClearIncoming(XTensor * node)
}
income.ClearTail();
income.typeID = 0;
income.type[0] = 0;
}
/*
......@@ -360,12 +364,13 @@ void XLink::Replace(const XTensor * oldOne, XTensor * newOne)
XLink::ClearOutgoing(newOne);
XLink::ClearIncoming(newOne);
/* incoming nodes */
if(oldOne->income.typeID != 0){
if(newIncome.tailNum < oldOne->income.tailNum){
delete[] newIncome.tails;
newIncome.tails = new XTensor*[oldOne->income.tailNum];
}
/* incoming nodes */
newIncome.SetType(oldOne->income.typeID);
newIncome.head = newOne;
newIncome.tailNum = oldOne->income.tailNum;
......@@ -388,6 +393,7 @@ void XLink::Replace(const XTensor * oldOne, XTensor * newOne)
CheckNTErrors(hit, "No proper node found in child.outgo edge!");
}
}
}
if(newOutgo.tailNum < oldOne->outgo.tailNum){
delete[] newOutgo.tails;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论