Synchronization of gtk_tree_store add/remove events



Dear all,

I have an application where I use a tree-view to display some data from an external hardware.
Different Objects can be added or removed to the treestore, each existing object in the treestore has a 
specific
id which is used to get data over some communication interface.

It can easily happen, the the user deselects an object in the treestore while this communication is ongoing.
This means that my treepath or iter which I rembered befor is not valid anymore after the communication has 
finished (*1).

To avoid access to not existing memory (*2) I currently use gtk_tree_store_iter_is_valid, but the 
documentation recommends to no use this function.
Even I didn't notice any increase of cpu load or timing influence, I want to follow this recommendation.

Of course I can think about implementing a selfmade locking mechanism, but every alternative I considered so 
far
which is under all circumstances is not inconvenient for the user requires a queue to store the add / 
deselect events.
For my feeling this is to much overhead for just this function, does anyone see an other alternative?
Maybe there is existing some g_lib stuff for this?

In my current implementation it would be very good, if gtk_tree_model_filter_convert_iter_to_child_iter would 
have a return value.
It already produces an gtk_warning if the iter could not be converted so why no return value?

*1 (the communication itself is handled in a functions called from g_idle_add, so no thread issue etc.)
*2 (my application can crash at gtk_tree_model_get, if the iter is not valid)

ps:
One other Idea I just had while writing this is to add a boolean column to the treestore where I mark columns 
which should be removed.
This I can handle in my communication callback function, together with a column visible flag this will not be 
noticeable.
I allready have 18 columns in the treestore, this would be the 19th, no problem or?


Well, If there is no other Idea, thanks for listening.


regards
        Arne



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