<div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Yes. Why should the interface life longer? There isn't any owner<br>anymore? If you need a longer life time, you need to assign the
<br>interface to something.</blockquote><div><br>i have many structures like this (yes, in delphi):<br><br>function TXList.Lock: ILock;<br>begin<br>  result := TLock.Create(self);<br>end;<br><br>procedure dostuff;<br>begin
<br>  list.Lock;<br>  // use the locked list<br>  // when ILock is out of scope, unlocks the list<br>end;<br><br>i know the obvious solution is to assign it:<br><br>procedure dostuff;<br>var<br>  l: ILock;<br>begin<br>
  l := list.Lock; // assign it<br>
  // use the locked list<br>
  // when ILock is out of scope, unlocks the list<br>
end;<br>
<br>but it is a lot of work (it is a big project) and my pals are not so happy ):-\<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Porting from what? Delphi? Are you sure that it didn't on Delphi by<br>accident?</blockquote><div><br>i really don't know if it was accident, but we  found it useful.<br></div></div><br>