Re: glibc utility function errors



Murray Cumming wrote:
On Sun, 2006-04-23 at 21:03 -0400, Matt Bragano wrote:
Every time I use the glibc utility functions (Glib::get_home_directory() specifically), I receive this runtime error:

The library is called glibmm, not glibc. Also, I think you mean
Glib::get_home_dir().

*** glibc detected *** double free or corruption (out): 0x080827f8 ***

valgrind might help you to detect the cause of this kind of problem. I
guess that it is caused by some other part of your program.

However, if I replace Glib::get_home_directory() with a hard coded path (i.e. /home/matt/) everything seems to work fine.

I'm fairly new to both c++ and gtkmm, so please excuse me if this is an obvious thing or the wrong list.

I can't see any problem in the implementation of that method:

std::string get_home_dir()
{
  const char *const value = g_get_home_dir();
  return (value) ? std::string(value) : std::string();
}

But I suppose there could be a problem in g_get_home_dir(). If you can
reduce this to a simple test case then we can investigate.

Sorry for the late response. I went ahead and used the implementation rather than the get_home_dir() method like so:

const gchar *const phome = g_get_home_dir();

and it worked just fine. I suspect this is due to the fact that I built gtkmm from the sources rather than using a distro-specific package since I couldn't find any good Slackware packages. Other than that I haven't had any troubles, and I'm not familiar enough with c++ to dig up the true source of the problem. If I happen to come across the reason for this behavior I'll let you know.

Also, if anyone knows where to get a solid build for Slackware 10.2 I'd be glad to give that a shot and see if it clears this up.

Thanks,
Matt Bragano



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]