<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>Source in question:&nbsp;<span class="Apple-style-span" style="font-family: Arial; font-size: 12px; ">sfx2/source/doc/doctemplates.cxx</span></div><div><span class="Apple-style-span" style="font-family: Arial; font-size: 12px; "><br></span></div><div><span class="Apple-style-span" style="font-family: Arial; font-size: 12px; ">The code looks like this:</span></div><div><span class="Apple-style-span" style="font-family: Arial; font-size: 12px; "><div><br></div><div>//-----------------------------------------------------------------------------</div><div><br></div></span></div><div><span class="Apple-style-span" style="font-family: Arial; font-size: 12px; "><div>struct NamePair_Impl</div><div>{</div><div>&nbsp;&nbsp; &nbsp;OUString maShortName;</div><div>&nbsp;&nbsp; &nbsp;OUString maLongName;</div><div>};</div><div><br></div><div><div>DECLARE_LIST( NameList_Impl, NamePair_Impl* )</div></div><div><br></div><div><div>class SfxDocTplService_Impl</div><div>{</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>...</div><div>&nbsp;&nbsp; &nbsp;NameList_Impl<span class="Apple-tab-span" style="white-space:pre">                                </span>maNames;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>...</div><div>&nbsp;&nbsp; &nbsp;void<span class="Apple-tab-span" style="white-space:pre">                                                </span>readFolderList();</div><div>&nbsp;&nbsp; &nbsp;OUString<span class="Apple-tab-span" style="white-space:pre">                                        </span>getLongName( const OUString&amp; rShortName );</div></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>...</div><div>}</div><div><br></div><div><div>void SfxDocTplService_Impl::readFolderList()</div><div>{</div><div>&nbsp;&nbsp; &nbsp;SolarMutexGuard aGuard;</div><div><br></div><div>&nbsp;&nbsp; &nbsp;ResStringArray &nbsp;aShortNames( SfxResId( TEMPLATE_SHORT_NAMES_ARY ) );</div><div>&nbsp;&nbsp; &nbsp;ResStringArray &nbsp;aLongNames( SfxResId( TEMPLATE_LONG_NAMES_ARY ) );</div><div><br></div><div>&nbsp;&nbsp; &nbsp;NamePair_Impl* &nbsp;pPair;</div><div><br></div><div>&nbsp;&nbsp; &nbsp;USHORT nCount = (USHORT)( Min( aShortNames.Count(), aLongNames.Count() ) );</div><div><br></div><div>&nbsp;&nbsp; &nbsp;for ( USHORT i=0; i&lt;nCount; i++ )</div><div>&nbsp;&nbsp; &nbsp;{</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;pPair = new NamePair_Impl;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;pPair-&gt;maShortName &nbsp;= aShortNames.GetString( i );</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;pPair-&gt;maLongName &nbsp; = aLongNames.GetString( i );</div><div><br></div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;maNames.Insert( pPair, LIST_APPEND );</div><div>&nbsp;&nbsp; &nbsp;}</div><div>}</div></div><div><br></div><div><div>OUString SfxDocTplService_Impl::getLongName( const OUString&amp; rShortName )</div><div>{</div><div>&nbsp;&nbsp; &nbsp;OUString &nbsp; &nbsp; &nbsp; &nbsp; aRet;</div><div>&nbsp;&nbsp; &nbsp;NamePair_Impl &nbsp; *pPair = maNames.First();</div><div><br></div><div>&nbsp;&nbsp; &nbsp;while ( pPair )</div><div>&nbsp;&nbsp; &nbsp;{</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if ( pPair-&gt;maShortName == rShortName )</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;aRet = pPair-&gt;maLongName;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;break;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;else</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pPair = maNames.Next();</div><div>&nbsp;&nbsp; &nbsp;}</div><div><br></div><div>&nbsp;&nbsp; &nbsp;if ( !aRet.getLength() )</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;aRet = rShortName;</div><div><br></div><div>&nbsp;&nbsp; &nbsp;return aRet;</div><div>}</div></div><div><br></div><div>//-----------------------------------------------------------------------------</div><div><br></div><div>No where in the code can I see where maNames gets cleanup up. The only destructor is in the base class which just cleans up the list memory and doesn't free the NamePair_Impl memory.</div><div><br></div><div><div>Container::~Container()</div><div>{</div><div>&nbsp;&nbsp; &nbsp;DBG_DTOR( Container, DbgCheckContainer );</div><div><br></div><div>&nbsp;&nbsp; &nbsp;// Alle Bloecke loeschen</div><div>&nbsp;&nbsp; &nbsp;CBlock* pBlock = pFirstBlock;</div><div>&nbsp;&nbsp; &nbsp;while ( pBlock )</div><div>&nbsp;&nbsp; &nbsp;{</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;CBlock* pTemp = pBlock-&gt;GetNextBlock();</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;delete pBlock;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;pBlock = pTemp;</div><div>&nbsp;&nbsp; &nbsp;}</div><div>}</div><div><br></div></div><div>I'm thinking of just adding code to ~SfxDocTplService_Impl() to free the NamePair_Impl items.</div><div><br></div><div>What I'd like to know is the following:</div><div><br></div><div>1. Am I reading this correctly?</div><div>2. Where is this uses, so I can test my changes? (I'm converting the above code to use a vector&lt;&gt;)</div><div><br></div><div>The use path is:</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>NamePair_Impl</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>SfxDocTplService_Impl</div><div><span class="Apple-tab-span" style="white-space:pre">        Updater_Impl</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-tab-span" style="white-space:pre">        SfxDocTplService_Impl</span> </span>(yes, it's a circular definition)</div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-tab-span" style="white-space:pre">        SfxDocTplService</span></span></span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-tab-span" style="white-space:pre"><br></span></span></span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-tab-span" style="white-space:pre">        SfxDocTplService</span> </span>i</span>s</span>&nbsp;registered as&nbsp;com.sun.star.frame.DocumentTemplates</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>which gets used in:</div><div><span class="Apple-tab-span" style="white-space:pre">                svtools/source/contnr/templwin.cxx</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-tab-span" style="white-space:pre">                sd/source/ui/dlg/TemplateScanner.cxx</span></span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-tab-span" style="white-space:pre"><br></span></span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-tab-span" style="white-space:pre">J</span>o</span>e P.</div></span></div></body></html>