Re: Error in Qt::Table::text(i, j), Qt::TableItem::text().

Ashley Winters <[email protected]> Thu, 2 Jun 2005 02:04:04 -0700 (PDT)
Newsgroups gmane.comp.kde.devel.perl
Message-ID <[email protected]>
--- Alexey Dashevsky <[email protected]> wrote:
> Hello all!
> 
> Thank for amicable silence;-)
> 
> Has refreshed files from cvs PerlQt-3, the memory leak at plotting
> the table 
> has stopped. But memory flows also by call of methods
> Qt::Table::text(i, j), 
> Qt::TableItem::text().
> 
> This bugs will be corrected?

I didn't actually try the code, but I'm pretty sure I know why it
leaks.

Qt.xs/VirtualMethodReturnValue line XXX:
    bool cleanup() { return false; }

Always returning false means that virtual function return-values
allocated with new() will never be deleted. In this case, that means a
'QString' gets leaked on every call. The correct function is probably:

class VirtualMethodReturnValue : public Marshall {
    // ...
    bool cleanup() { return(_st.isClass() && _st.isStack()); }
    // ...
};

Can you try that change and see if it leaks, Alexey?

Ashley Winters

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com