comparison generator/dgenerator.cpp @ 393:1049b01aebd2

Fixed generator segfaults on OS X 10.6. Regarding the change to dgenerator.cpp, I am not actually sure if 0 is the correct value to pass, but it seems to work and the code which had been there before was just plain incorrect ? it read past the list boundaries.
author David Nadlinger <code@klickverbot.at>
date Sat, 28 Aug 2010 02:55:55 +0200
parents 7dddafad5a20
children
comparison
equal deleted inserted replaced
392:6bd75093d3bb 393:1049b01aebd2
658 QList<ReferenceCount> referenceCounts; 658 QList<ReferenceCount> referenceCounts;
659 for (int i=0; i<arguments.size() + 1; ++i) { 659 for (int i=0; i<arguments.size() + 1; ++i) {
660 referenceCounts = d_function->referenceCounts(d_function->implementingClass(), 660 referenceCounts = d_function->referenceCounts(d_function->implementingClass(),
661 i == 0 ? -1 : i); 661 i == 0 ? -1 : i);
662 662
663 foreach (ReferenceCount refCount, referenceCounts) 663 foreach (ReferenceCount refCount, referenceCounts) {
664 writeReferenceCount(s, refCount, i == 0 ? "this" : arguments.at(i-1)->argumentName(), arguments.at(i-1)->type()); 664 // TODO: What is the correct value to pass as last parameter if (i == 0)?
665 writeReferenceCount(s, refCount, i == 0 ? "this" : arguments.at(i-1)->argumentName(), i == 0 ? 0 : arguments.at(i-1)->type());
666 }
665 } 667 }
666 668
667 referenceCounts = d_function->referenceCounts(d_function->implementingClass(), 0); 669 referenceCounts = d_function->referenceCounts(d_function->implementingClass(), 0);
668 AbstractMetaType *return_type = d_function->type(); 670 AbstractMetaType *return_type = d_function->type();
669 QString new_return_type = QString(d_function->typeReplaced(0)).replace('$', '.'); 671 QString new_return_type = QString(d_function->typeReplaced(0)).replace('$', '.');