CList memory management with C++ ...



When one calls gtk_clist_append(GtkCList * , gchar * text [])

does the clist performs a deep copy of the data in text, or does it just
maintain references to the data in the original array?

My purpose for asking is to determine if the following piece of C++ w/ gtk will
work correctly and won't cause any black-magic voodoo-style bugs down the road:

myClist = gtk_clist_new(1);

for (std::list<std::string>::iterator i = l.begin; i != l.end(); ++i)
{
   char * ptr = i->c_str();  // <- this is the piece that I'm worried about...

   gtk_clist_append(GTK_CLIST(myClist), &ptr);
}

Thanks in advance,
John Schmerge

---------------------------
John Schmerge
schmerge cyber com




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