<div dir="rtl"><div dir="ltr">Hi Vassil,</div><div dir="ltr"><br></div><div dir="ltr">Do you mean double destruction (not deletion) of <span style="font-family:arial,sans-serif;font-size:12.727272033691406px">MacroInfo first time in </span><span style="font-family:arial,sans-serif;font-size:12.727272033691406px">ReleaseMacroInfo </span><span style="font-family:arial,sans-serif;font-size:12.727272033691406px">and the second time in </span>~Preprocessor via ~MacroInfoChain?</div>
<div dir="ltr"><br></div><div dir="ltr"><div dir="ltr"> while (MacroInfoChain *I = MIChainHead) {</div><div dir="ltr"> MIChainHead = I->Next;</div><div dir="ltr"> I->~MacroInfoChain();</div><div dir="ltr"> }</div>
<div><br></div><div>or something else?</div><div><br></div><div>Yaron<br></div></div><div dir="ltr"><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div dir="ltr">2014-08-02 23:05 GMT+03:00 Vassil Vassilev <span dir="ltr"><<a href="mailto:vvasilev@cern.ch" target="_blank">vvasilev@cern.ch</a>></span>:</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
In cases where ReleaseMacroInfo gets called and it doesn't cleanup the Preprocessor's MIChainHead can lead to double deletion. I am sending the patch that fixes the problem for me.<br>
Vassil<br>
<br>
<br>
diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp<br>
index 5f38387..1a9b5eb 100644<br>
--- a/lib/Lex/PPDirectives.cpp<br>
+++ b/lib/Lex/PPDirectives.cpp<br>
@@ -94,6 +94,14 @@ Preprocessor::<u></u>AllocateVisibilityMacroDirecti<u></u>ve(SourceLocation Loc,<br>
/// error in the macro definition.<br>
void Preprocessor::<u></u>ReleaseMacroInfo(MacroInfo *MI) {<br>
// Don't try to reuse the storage; this only happens on error paths.<br>
+<br>
+ // If this is on the macro info chain, avoid double deletion on teardown.<br>
+ while (MacroInfoChain *I = MIChainHead) {<br>
+ if (&(I->MI) == MI)<br>
+ I->Next = (I->Next) ? I->Next->Next : 0;<br>
+ MIChainHead = I->Next;<br>
+ }<br>
+<br>
MI->~MacroInfo();<br>
}<br>
<br>
______________________________<u></u>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>