Re: boxed re-registration key freeing
- From: Kevin Ryde <user42 zip com au>
- To: gtk-perl-list gnome org
- Subject: Re: boxed re-registration key freeing
- Date: Thu, 29 Jan 2009 08:01:33 +1100
muppet <scott asofyet org> writes:
It looks like gperl_boxed_register() takes precautions to insert into
the hash with the destructor second, to avoid this sort of problem.
Why isn't that working?
g_hash_table_insert() on info_by_package leaves the key string set to
the one in the original boxed_info, but it's then freed. I think
g_hash_table_replace() will change to the key string of the new
boxed_info. Same string contents of course, new pointer.
Electric fence or the like might detect an access after free, but it
might depend on the hashing, and I don't have enough ram to run it up
that way :).
Some printfs at judicious points show garbage though, with the border
not the only one getting a re-registration at some point.
void hprint (gpointer key,
gpointer value,
gpointer user_data)
{
printf (" %s[%p]", key, key);
}
if (strcmp(package,"Gtk2::Border") == 0) {
printf ("gperl_register_boxed %s %p\n",
boxed_info->package, boxed_info->package);
}
{
printf ("Lookup:");
g_hash_table_foreach (info_by_package, hprint, NULL);
printf ("\n");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]