Issue 106576 - wbutton.cxx: bad call to erase
Summary: wbutton.cxx: bad call to erase
Status: UNCONFIRMED
Alias: None
Product: Writer
Classification: Application
Component: code (show other issues)
Version: DEV300m63
Hardware: All Linux, all
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords: needhelp
Depends on:
Blocks: 106602
  Show dependency tree
 
Reported: 2009-11-03 12:02 UTC by dcb314
Modified: 2014-04-09 19:00 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
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.