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

Ashley Winters jahqueel at yahoo.com
Thu Aug 14 23:02:20 UTC 2008


--- On Thu, 8/14/08, Chris Burel <chrisburel at gmail.com> wrote:
> 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.

That glibc error is cause by a double free(). Since it's handling a perl SV* at the time, that's a bit odd. If you recompile perl and let it use its own malloc() implementation, you might get slightly better debugging.

The stack trace is showing that sv_catpvn(sv, "string") had to grow the string buffer (hence it dropping into realloc()). Once realloc() copied to the new buffer, it decided to free() the original buffer, and then glibc noticed that its malloc datastructure was corrupt.

If I were to guess, I'd say the SvREFCNT is wrong (on the low side) on whatever variable(s) you're exchanging via autoload.

- Ashley Winters


      



More information about the Kde-bindings mailing list