question about GtkTreeIter



Hi
first, let's compare two pieces of codes:

No.1
{
GtkTreeIter* iter;
    gtk_tree_store_append(store, iter, parent);
    gtk_tree_store_set(store, iter, COLUMN_NAME, node->name,
COLUMN_TYPE, node->content, -1);
}

No.2
{
GtkTreeIter iter;
    gtk_tree_store_append(store, &iter, parent);
    gtk_tree_store_set(store, &iter, COLUMN_NAME, node->name,
COLUMN_TYPE, node->content, -1);
}

they are both compiled successfully, but when i run the program compiled
from No.1, it was dumped and report an error: segmentation fault(core
dumped).
when i run the program compiled from No.2, the problem will be resolved.

what is the difference between these two codes?




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