Issue 106576

Summary: wbutton.cxx: bad call to erase
Product: Writer Reporter: dcb314 <dcb314>
Component: codeAssignee: AOO issues mailing list <issues>
Status: UNCONFIRMED --- QA Contact:
Severity: Trivial    
Priority: P3 CC: elish, issues, philipp.lohmann
Version: DEV300m63Keywords: needhelp
Target Milestone: ---   
Hardware: All   
OS: Linux, all   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Issue Depends on:    
Issue Blocks: 106602    

Description dcb314 2009-11-03 12:02:05 UTC
For source code file toolkit/source/layout/vcl/wbutton.cxx,
function Remove, around line 500 is the following code

        for ( std::list< Window*>::iterator it = maAdvanced.begin();
              it != maAdvanced.end(); it++ )
            if ( *it == w )
            {
                lst.erase( it );
                return *it;
            }

So local variable "it" iterates over maAdvanced, but it is used
on variable "lst". This looks wrong. Maybe the loop should iterate
over lst, not maAdvanced ?
Comment 1 eric.savary 2009-11-03 12:05:19 UTC
@PL: Please have a look.
Comment 2 philipp.lohmann 2009-11-03 12:21:47 UTC
pl->jcn: yes, the way it is it is certainly wrong. Moreover this Remove function
removes it on lst, which is a list passed by value; in other words it removes
the iterator from a temporary object resulting in no net effect aside from
returning not NULL when the passed window was found. I assume lst should have
been a reference instead of value ?
Comment 3 jcn 2009-11-03 12:31:56 UTC
> I assume lst should have been a reference instead of value ?

@pl: yes, that's what I figure too, looking at this code. 
Comment 4 caolanm 2010-05-22 17:41:59 UTC
poke, do we have a fix for this or will I cook one up ?
Comment 5 thorsten.ziehm 2010-09-23 15:22:26 UTC
OOo 3.3 is in showstopper-mode. This issue doesn't look like a stopper for the
current release. I change the target to OOo 3.x. Please change the target
accordingly when a fix is near to be integrated into a code line or promote it
as stopper issues at the mailing list releases@openoffice.org, when it is urgent
enough for OOo 3.3.
Comment 6 Rob Weir 2013-07-30 02:39:15 UTC
Reset assignee on issues not touched by assignee in more than 1000 days.