Re: Simple GTK error



On Tue, Jun 27, 2006 at 01:17:16PM +0200, simon kendall wrote:
I'm writing a function for adding the name of a C++ object into a
listbox - using GStrings for it's nifty functions. The
gtk_list_item_new_with_label only accepts gchars, so I want to change
the GString into a gchar, named label, by taking the internal gchar of
the GString struct and copying it into the gchar.

int AddItemToList(int type, GString *sText) {
              GtkWidget *item;
              gchar *label;
              /*label = sText->str;*/
              item = gtk_list_item_new_with_label(label);

But at the commented line, the program shuts down(using Windows and
can as such not get  a real reason).
Anyone know how to fix this, or an alternate way of solving the
general problem(What with passing in a GString to the function)?

The code excerpt is all right, you could even directly pass
sText->str to gtk_list_item_new_with_label().  So more
likely the GString gets corrupted somewhere before, in code
not shown.  Or the function gets wrong arguments.  Or it
actually crashes later in a consequence of ...

In addition:

[cite]
  GtkList has has been deprecated since GTK+ 2.0 and should
  not be used in newly written code. Use GtkTreeView instead.
[/cite]

Yeti


--
Anonyms eat their boogers.



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