[Kde-perl] Memory fault when inserting QTableItem into QTable

Richard Dale Richard_Dale at tipitina.demon.co.uk
Fri Jul 9 17:53:40 CEST 2004


On Friday 09 July 2004 09:33, Oliver Kreuer wrote:
> I appended two example scripts with input files.
> Script "table_fault.pl" reproduces the memory fault whereas
> "table_ok.pl" contains a work around. The work around is not very
> pleasant so I'm still interested why this memory fault occurs.
> Due to bug #924345 the work around has to use takeItem insted of removeRow.
Here's my attempt at fixing this. I think the problem is that when a perl 
instance is garbage collected and the DESTROY method is called, the perlqt 
runtime will only delete the C++ instance if it doesn't have a parent. In 
this case the Qt::TableItem has a parent and the C++ instance wasn't deleted. 
However, perlqt still think it owns the instance - I think that part is 
wrong. So I've changed it so that perlqt no longer thinks it owns the C++ 
item under those circumstances.

I think this needs more thought, but please try the attached patch. 

I've also translated your example to qtruby, and confirmed that doesn't have a 
similar problem.

-- Richard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: perlqtcrashfix_0.1.patch
Type: text/x-diff
Size: 357 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-perl/attachments/20040709/d9772a4a/perlqtcrashfix_0.1.bin


More information about the Kde-perl mailing list