Re: Treeview CRITICAL Error



dhk wrote:
only seems to compile when the -O (Optimization) option is present. However the options is set as -O0 (that's Dash-Oh-Zero) which should turn optimization off. I'd like to be able to compile the program without optimization, but so far this has just been an annoyance.
In my opinion every application should try to compile without warnings AND run fine with -O0, -O2, -O3. If your app does not compile AND run fine with -O0 to -O3 then you should stop and try to understand why. Think about it as an opportunity to know better your application!

Sometime ago, my app was behaving in a strange way when compiling with -O3, although it worked fine with -O2. I tracked down the problem to just 2, 3 lines of complex, cheesy code, separated by commas. Replacing these 2, 3 lines by 4, 5 lines of simple, robust code, solved the issue.
Third - the problem. The application window has a notebook with a handful of tabs, each with different tree views on them. The program seems to run fine. However, when the second tab is selected, no matter what the previous tab was, the following three error lines get printed about three times.
I use a lot of notebooks and treeviews myself and they work fine. Probably this is a problem of compatibility between your TreeViews and TreeStores.

Are you sure the number of columns and their type is right? the treeviews are visible? the tree stores are visible? there is no confusion between them when you change from one Treeview to another? do you understand well the Treeview/TreeStore model?
Now the strange part. The functions that call gtk_tree_store_prepend() and gtk_tree_view_set_cursor() get a tree view pasted in as a gpointer and then it's cast to a GtkWidget. In the debugger when the tree view is printed it says "<value optimized out>" and when printed with a star '*' preceding the tree view it displays 0x0: NULL.
You can print the memory address of your treeviews, when you create them, and then in a few selected places, for example:

printf ("treeview in callback: %d\n", my_tree_view); /* ignore the warning */
fflush (stdout);

to assert if you get always the memory address you expect. Otherwise something is wrong.

If you get NULL when you expected your treeview address, this is usually an error easy to track down.

Carlos






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