"Clear all breakpoints" code question

Andras Mantia amantia at kde.org
Thu Nov 10 14:41:09 UTC 2005


Hi,
On Thursday 10 November 2005 13:53, Vladimir Prus wrote:
> Hi Andras,
> I have a question about kdevelop code that seems to be written by
> you. In gdbbreakpointwidget.cpp, method
> GDBBreakpointWidget::slotRemoveAllBreakpoints(), we have this:
[...]
> We iterate over all breakpoints (the "for" loop), and we repeat it
> again and again until there are breakpoinst (the "while" loop). The
> while loop was added by you in:
>
>    281634 | amantia | 2004-01-21 22:23:35 +0300 (Wed, 21 Jan 2004) |
> 2 lines
>
>    Fix clear all breakpoints.
>
> The log message is not clear for me. 

Without the loop, not all breakpoint entries were removed. ;-)

> It does not say what problem 
> there was, nor does it refer to a bug in the tracker. Can you clarify
> why "while" is needed?

Well, it was quite some time back (2 years?). But as I remember and see, 
the commit was more a workaround. The problem is somewhere that 
removeBreakpoint(btr) removes a row from a QTable and this breaks the 
walkthrough based on row (m_table->item query), and it will return a 
null pointer, which means removeBreakpoint won't remove anything, and 
we will remain with stale rows.
A nicer solution might be two different loops:
1) gather all the BreakpointTableRow in a list
2) go through this list and call removeBreakpoint() for each list item

Might be more understandable than now. ;-)

Andras

-- 
Quanta Plus developer - http://quanta.kdewebdev.org
K Desktop Environment - http://www.kde.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20051110/63b55fff/attachment.sig>


More information about the KDevelop-devel mailing list