Re: Text of a gtk_ctree_node



On Thu, Aug 24, 2000 at 09:46:14PM +0500, Vlad Harchev wrote:
> As I remember your code, you should use 'text' but not 'string' since
> 'string' points to unallocated memory when g_message is called. Could you 
> also use printf("%s\n",text);

Here's the code if you don't remember it:

void
on_button6_clicked                     (GtkButton       *button,
                                        gpointer         user_data)
{
        /**
         * pressione di smonta partizione
         */
        char *string;
        char *text;
        int i = 0;
        GtkWidget *tmp;
        GtkWidget *node;
        if ((GTK_CLIST (ctree1)->selection != NULL) && (GTK_CLIST (ctree1)->selection->data != NULL)) {
                tmp = GTK_CLIST (ctree1)->selection->data;
                node = gtk_ctree_find_node_ptr (GTK_CTREE (ctree1), GTK_CTREE_ROW (tmp));
                i = gtk_ctree_node_get_text (GTK_CTREE (ctree1), GTK_CTREE_NODE
(node), 0, &string);
                text = strdup(string);  /* <---- HERE IT CRASHES */
                //g_strescape(text);
                //g_message ("%s", text);
                gtk_ctree_remove_node (GTK_CTREE (ctree1), GTK_CTREE_NODE (node));
        } else {
                umounting_error_messagebox = create_messagebox_error_umounting ();
                gtk_widget_show_all (umounting_error_messagebox);
        }
}

I  don't know  why  it crashes.  If  I  comment that  line  and I  write
printf("%d", i);after it it crashes. Do you have got any idea?

Bye

-- 
Non c'è più forza nella normalità, c'è solo monotonia.





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