[Kde-bindings] glibc realloc error with QTableView::setRootIndex in PerlQt4

Chris Burel chrisburel at gmail.com
Thu Aug 14 09:29:07 UTC 2008


Thanks for you guys' previous help.  I really feel like I'm learning a lot.

This is merely a beginning of what I hope will become a complete PerlQt4
binding using smoke:
svn checkout http://perlqt4.googlecode.com/svn/branches/PerlQtSimple
I hope you guys will forgive me putting it in a separate repository, but I
don't completely know what I'm doing. :-)  And the Makefile.PL isn't exactly
automatic, but I assume you guys will know what to link it to.

I have an XS_AUTOLOAD function that only handles calls to c++.  I'm trying
to keep it relatively simple until I fully understand everything, so it
doesn't look for any perl subroutines.  It just calls the smoke function,
gets the return value, and shoves that back into an SV.

My current problem is this.  I've had to define a custom function for
QTableView::setRootIndex.  It has to do less work than XS_AUTOLOAD to figure
out what's going on, but the code looks to me like it would do the same
thing.  If you compile and run the perl script examples/UsingModelsAndViews
(based on http://doc.trolltech.com/4.4/model-view-using.html), it works just
fine.

But now try commenting out the last line of QtSimple.xs, that defines the
custom setRootIndex xs function.  On my machine here at home, which is 32
bit running Fedora Core 5 with Qt-4.4.0, I get this when it tries to run
line 19:
$table1->setRootIndex( $modelIndex );
*** glibc detected *** /usr/bin/perl: realloc(): invalid next size:
0x089143c0 ***

I threw in some debugging fprintf's, and it gets past the XSRETURN(1) line.
This is what really confuses me, that it's something happening after it
leaves XS_AUTOLOAD.

I tried it on a machine at work running ...some version of Suse, Qt-4.3.4,
but 64 bit.  The results were inconsistent.  I compiled it once, and it
segfaulted.  But when I compiled again later, it worked ok.  Both machines
worked fine with the custom setRootIndex xs function.

Here's the backtrace, if that helps:
#0  0x00e1d402 in __kernel_vsyscall ()
#1  0x4e4efcce in __lll_mutex_lock_wait () from /lib/libc.so.6
#2  0x4e482978 in _L_lock_14004 () from /lib/libc.so.6
#3  0x4e481f63 in free () from /lib/libc.so.6
#4  0x4db9ac88 in _dl_map_object_deps () from /lib/ld-linux.so.2
#5  0x4db9f301 in dl_open_worker () from /lib/ld-linux.so.2
#6  0x4db9b899 in _dl_catch_error () from /lib/ld-linux.so.2
#7  0x4db9edaa in _dl_open () from /lib/ld-linux.so.2
#8  0x4e5168be in do_dlopen () from /lib/libc.so.6
#9  0x4db9b899 in _dl_catch_error () from /lib/ld-linux.so.2
#10 0x4e516a49 in __libc_dlopen_mode () from /lib/libc.so.6
#11 0x4e4f5f06 in init () from /lib/libc.so.6
#12 0x4e6ba58b in pthread_once () from /lib/libpthread.so.0
#13 0x4e4f5ff4 in backtrace () from /lib/libc.so.6
#14 0x4e477551 in __libc_message () from /lib/libc.so.6
#15 0x4e48039b in _int_realloc () from /lib/libc.so.6
#16 0x4e482185 in realloc () from /lib/libc.so.6
#17 0x4564d7f7 in Perl_safesysrealloc () from
/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
#18 0x45668923 in Perl_sv_grow () from
/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
#19 0x456710c8 in Perl_sv_catpvn_flags () from
/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
#20 0x45605f80 in Perl_gv_autoload4 () from
/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
#21 0x45606304 in Perl_gv_fetchmethod_autoload () from
/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
#22 0x456063c3 in Perl_gv_fetchmethod () from
/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
#23 0x4565c793 in Perl_pp_const () from
/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
#24 0x4565cc8f in Perl_pp_method_named () from
/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
#25 0x4565c48f in Perl_runops_standard () from
/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
#26 0x45601dde in perl_run () from
/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
#27 0x0804934e in main ()

Any ideas?  General advice about what a realloc invalid next size means
would be helpful too.
Thanks,
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20080814/7435c8e4/attachment.html>


More information about the Kde-bindings mailing list