bug & patch - autoproject part, gideon forgets about external libs

Marco Krohn marco.krohn at web.de
Sat Apr 26 02:45:09 UTC 2003


Hi,

using gideon for one of my projects I found a bug in the autoproject part. 

Bug Description:
The project I am working consists of some libraries, and for some of them I 
use options->libraries -> Add in order to add "Link libraries outside the 
project". In most cases this works as expected, but for some libraries of my 
project gideon keeps forgetting the external library.

Problem description:
I think the problem is in "TargetOptionsDialog::readConfig()". The strings are 
read correctly, but the following code does not work as expected. The setting 
is that there is one "library inside project" and one outside.

for (l2it = l2.begin(); l2it != l2.end(); ++l2it) {
  QCheckListItem *clitem = 
static_cast<QCheckListItem*>(insidelib_listview->firstChild());
        if (flitem) {
            while (clitem) {
                if (*l2it == ("$(top_builddir)/" + clitem->text())) {
                    clitem->setOn(true);
                    // move this item to the "top of the list"
                    if (flitem != clitem)
                      clitem->moveItem(flitem);
                    // move the "top of the list" one item down
                    flitem = 
static_cast<QCheckListItem*>(flitem->nextSibling());
                    break;
                }
                clitem = static_cast<QCheckListItem*>(clitem->nextSibling());
            }
        }
        if (!clitem) {
            QListViewItem *item = new QListViewItem(outsidelib_listview, 
*l2it);
            if (lastItem)
                item->moveItem(lastItem);
            lastItem = item;
        }
    }

During the first iteration the l2it points towards the "internal name", does 
some "strange" things in order to activate the checkbox and finally ends the 
first while-loop with a "break". Before flitem is moved and since there was 
only one element in the internal list flitem = 0 now. Everything correct so 
far, but note that clitem now still is non-zero. In the second iteration l2it 
points towards the "external lib name", flitem=0, but also clitem!=0 
therefore nothing happens (which is wrong).

The idea of the original code was probably: if no internal name found (the 
while loop), then clitem will point to the end of the list and one can use 
the name as an external lib (if (!clitem) ... part). 

Solution:
The attached patch makes things more explicit by introducing a flag (bool) 
which marks whether the name is used internally or externally. 

Please check and test, it seems to work for me.

Gideon is great, many thanks!

best regards,
  Marco













-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-gideo-autoproject.diff
Type: text/x-diff
Size: 1680 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20030426/ed7d144f/attachment.bin>


More information about the KDevelop-devel mailing list