summaryrefslogtreecommitdiff
path: root/src/lib/elementary
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2018-12-07 11:26:54 +0100
committerXavi Artigas <xavierartigas@yahoo.es>2018-12-07 11:47:21 +0100
commit4d6f20d714ea083471be163f67af518eced4028c (patch)
tree25574de63f6c0d2742859530ca202115534dc978 /src/lib/elementary
parent89683f49cab7d55e8184907335eb1360a156a49d (diff)
elementary: make Efl.Ui.Factory.create asynchronous.
Reviewers: felipealmeida, SanghyeonLee, vitor.sousa, bu5hm4n, segfaultxavi Reviewed By: felipealmeida, vitor.sousa, segfaultxavi Subscribers: segfaultxavi, #reviewers, #committers Tags: #efl Maniphest Tasks: T7472 Differential Revision: https://phab.enlightenment.org/D7332
Diffstat (limited to 'src/lib/elementary')
-rw-r--r--src/lib/elementary/efl_ui_image_factory.c9
-rw-r--r--src/lib/elementary/efl_ui_layout.c146
-rw-r--r--src/lib/elementary/efl_ui_layout_factory.c11
-rw-r--r--src/lib/elementary/efl_ui_list_view.c68
-rw-r--r--src/lib/elementary/efl_ui_list_view_seg_array.h2
-rw-r--r--src/lib/elementary/efl_ui_list_view_types.eot1
6 files changed, 197 insertions, 40 deletions
diff --git a/src/lib/elementary/efl_ui_image_factory.c b/src/lib/elementary/efl_ui_image_factory.c
index 9607665e06..998c43f70d 100644
--- a/src/lib/elementary/efl_ui_image_factory.c
+++ b/src/lib/elementary/efl_ui_image_factory.c
@@ -32,10 +32,11 @@ _efl_ui_image_factory_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Image_Fa
32 efl_destructor(efl_super(obj, MY_CLASS)); 32 efl_destructor(efl_super(obj, MY_CLASS));
33} 33}
34 34
35EOLIAN static Efl_Gfx_Entity * 35EOLIAN static Eina_Future *
36_efl_ui_image_factory_efl_ui_factory_create(Eo *obj EINA_UNUSED, Efl_Ui_Image_Factory_Data *pd, Efl_Model *model, Efl_Gfx_Entity *parent) 36_efl_ui_image_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Image_Factory_Data *pd, Efl_Model *model, Efl_Gfx_Entity *parent)
37{ 37{
38 Efl_Gfx_Entity *ui_view; 38 Efl_Gfx_Entity *ui_view;
39 Eina_Value r;
39 40
40 EINA_SAFETY_ON_NULL_RETURN_VAL(pd->property, NULL); 41 EINA_SAFETY_ON_NULL_RETURN_VAL(pd->property, NULL);
41 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); 42 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
@@ -43,7 +44,9 @@ _efl_ui_image_factory_efl_ui_factory_create(Eo *obj EINA_UNUSED, Efl_Ui_Image_Fa
43 efl_ui_view_model_set(ui_view, model); 44 efl_ui_view_model_set(ui_view, model);
44 efl_ui_model_connect(ui_view, "filename", pd->property); 45 efl_ui_model_connect(ui_view, "filename", pd->property);
45 46
46 return ui_view; 47 r = eina_value_object_init(ui_view);
48
49 return eina_future_resolved(efl_loop_future_scheduler_get(obj), r);
47} 50}
48 51
49EOLIAN static void 52EOLIAN static void
diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c
index c14bebac3d..5544e4e65e 100644
--- a/src/lib/elementary/efl_ui_layout.c
+++ b/src/lib/elementary/efl_ui_layout.c
@@ -69,6 +69,15 @@ static const char *_efl_ui_layout_swallow_parts[] = {
69 NULL 69 NULL
70}; 70};
71 71
72typedef struct _Efl_Ui_Layout_Factory_Tracking Efl_Ui_Layout_Factory_Tracking;
73
74struct _Efl_Ui_Layout_Factory_Tracking
75{
76 Efl_Ui_Factory *factory;
77 Eina_Future *in_flight;
78 Eina_Stringshare *name;
79};
80
72 81
73/* these are data operated by layout's class functions internally, and 82/* these are data operated by layout's class functions internally, and
74 * should not be messed up by inhering classes */ 83 * should not be messed up by inhering classes */
@@ -2034,13 +2043,68 @@ on_error:
2034 free(value); 2043 free(value);
2035} 2044}
2036 2045
2046typedef struct _Efl_Ui_Layout_Factory_Request Efl_Ui_Layout_Factory_Request;
2047struct _Efl_Ui_Layout_Factory_Request
2048{
2049 Efl_Ui_Layout_Factory_Tracking *tracking;
2050 Efl_Ui_Layout *obj;
2051 Efl_Ui_Layout_Data *pd;
2052 Efl_Ui_Factory *factory;
2053 const char *name;
2054};
2055
2056static Eina_Value
2057_content_created(void *data, const Eina_Value value)
2058{
2059 Efl_Ui_Layout_Factory_Request *request = data;
2060 Efl_Gfx_Entity *content = NULL;
2061 Efl_Gfx_Entity *old_content;
2062
2063 eina_value_get(&value, &content);
2064
2065 // Recycle old content
2066 old_content = elm_layout_content_get(request->obj, request->name);
2067 if (old_content) efl_ui_factory_release(request->factory, old_content);
2068
2069 // Set new content
2070 elm_layout_content_set(request->obj, request->name, content);
2071
2072 return value;
2073}
2074
2037static void 2075static void
2038_efl_ui_layout_view_model_content_update(Efl_Ui_Layout_Data *pd, Efl_Ui_Factory *factory, const char *name) 2076_clean_request(void *data, const Eina_Future *dead_future EINA_UNUSED)
2039{ 2077{
2040 Efl_Gfx_Entity *content; 2078 Efl_Ui_Layout_Factory_Request *request = data;
2079
2080 request->tracking->in_flight = NULL;
2081 eina_stringshare_del(request->name);
2082 efl_unref(request->factory);
2083 free(request);
2084}
2085
2086static void
2087_efl_ui_layout_view_model_content_update(Efl_Ui_Layout_Data *pd, Efl_Ui_Layout_Factory_Tracking *tracking, const char *name)
2088{
2089 Efl_Ui_Layout_Factory_Request *request = calloc(1, sizeof (Efl_Ui_Layout_Factory_Request));
2090 Eina_Future *f;
2091
2092 if (!request) return ;
2093
2094 if (tracking->in_flight) eina_future_cancel(tracking->in_flight);
2041 2095
2042 content = efl_ui_factory_create(factory, pd->connect.model, pd->obj); 2096 request->name = eina_stringshare_ref(name);
2043 elm_layout_content_set(pd->obj, name, content); 2097 request->pd = pd;
2098 request->obj = pd->obj;
2099 request->factory = efl_ref(tracking->factory);
2100 request->tracking = tracking;
2101
2102 f = efl_ui_factory_create(tracking->factory, pd->connect.model, pd->obj);
2103 f = eina_future_then_from_desc(efl_future_then(pd->obj, f),
2104 eina_future_cb_easy(.success = _content_created,
2105 .success_type = EINA_VALUE_TYPE_OBJECT,
2106 .data = request,
2107 .free = _clean_request));
2044} 2108}
2045 2109
2046static void 2110static void
@@ -2063,7 +2127,11 @@ _efl_ui_layout_view_model_update(Efl_Ui_Layout_Data *pd)
2063 2127
2064 it = eina_hash_iterator_tuple_new(pd->connect.factories); 2128 it = eina_hash_iterator_tuple_new(pd->connect.factories);
2065 EINA_ITERATOR_FOREACH(it, tuple) 2129 EINA_ITERATOR_FOREACH(it, tuple)
2066 _efl_ui_layout_view_model_content_update(pd, tuple->data, tuple->key); 2130 {
2131 Efl_Ui_Layout_Factory_Tracking *factory = tuple->data;
2132
2133 _efl_ui_layout_view_model_content_update(pd, factory, tuple->key);
2134 }
2067 eina_iterator_free(it); 2135 eina_iterator_free(it);
2068} 2136}
2069 2137
@@ -2083,7 +2151,7 @@ _efl_model_properties_changed_cb(void *data, const Efl_Event *event)
2083 Eina_Stringshare *sprop = eina_stringshare_add(prop); 2151 Eina_Stringshare *sprop = eina_stringshare_add(prop);
2084 const char *part; 2152 const char *part;
2085 const char *signal; 2153 const char *signal;
2086 Efl_Ui_Factory *factory; 2154 Efl_Ui_Layout_Factory_Tracking *factory;
2087 2155
2088 part = eina_hash_find(pd->connect.properties, sprop); 2156 part = eina_hash_find(pd->connect.properties, sprop);
2089 if (part) _efl_ui_layout_view_model_property_update(pd, part, sprop); 2157 if (part) _efl_ui_layout_view_model_property_update(pd, part, sprop);
@@ -2099,13 +2167,22 @@ _efl_model_properties_changed_cb(void *data, const Efl_Event *event)
2099} 2167}
2100 2168
2101static void 2169static void
2170_efl_ui_layout_factory_free(Efl_Ui_Layout_Factory_Tracking *tracking)
2171{
2172 if (tracking->in_flight) eina_future_cancel(tracking->in_flight);
2173 efl_unref(tracking->factory);
2174 eina_stringshare_del(tracking->name);
2175 free(tracking);
2176}
2177
2178static void
2102_efl_ui_layout_connect_hash(Efl_Ui_Layout_Data *pd) 2179_efl_ui_layout_connect_hash(Efl_Ui_Layout_Data *pd)
2103{ 2180{
2104 if (pd->connect.properties) return ; 2181 if (pd->connect.properties) return ;
2105 2182
2106 pd->connect.properties = eina_hash_stringshared_new(EINA_FREE_CB(free)); // Hash of property targeting a part 2183 pd->connect.properties = eina_hash_stringshared_new(EINA_FREE_CB(free)); // Hash of property targeting a part
2107 pd->connect.signals = eina_hash_stringshared_new(EINA_FREE_CB(free)); // Hash of property triggering a signal 2184 pd->connect.signals = eina_hash_stringshared_new(EINA_FREE_CB(free)); // Hash of property triggering a signal
2108 pd->connect.factories = eina_hash_stringshared_new(EINA_FREE_CB(efl_unref)); // Hash of property triggering a content creation 2185 pd->connect.factories = eina_hash_stringshared_new(EINA_FREE_CB(_efl_ui_layout_factory_free)); // Hash of property triggering a content creation
2109} 2186}
2110 2187
2111EOLIAN static void 2188EOLIAN static void
@@ -2139,15 +2216,21 @@ _efl_ui_layout_efl_ui_view_model_set(Eo *obj, Efl_Ui_Layout_Data *pd, Efl_Model
2139 it = eina_hash_iterator_tuple_new(pd->connect.factories); 2216 it = eina_hash_iterator_tuple_new(pd->connect.factories);
2140 EINA_ITERATOR_FOREACH(it, tuple) 2217 EINA_ITERATOR_FOREACH(it, tuple)
2141 { 2218 {
2142 Efl_Ui_Factory *factory; 2219 Efl_Ui_Layout_Factory_Tracking *factory;
2143 Efl_Gfx_Entity *content; 2220 Efl_Gfx_Entity *content;
2144 2221
2145 name = tuple->key; 2222 name = tuple->key;
2146 factory = tuple->data; 2223 factory = tuple->data;
2147 content = elm_layout_content_get(obj, name);
2148 2224
2225 // Cancel in flight creation request
2226 if (factory->in_flight) eina_future_cancel(factory->in_flight);
2227
2228 // Cleanup content
2229 content = elm_layout_content_get(obj, name);
2149 elm_layout_content_set(obj, name, NULL); 2230 elm_layout_content_set(obj, name, NULL);
2150 efl_ui_factory_release(factory, content); 2231
2232 // And recycle it
2233 efl_ui_factory_release(factory->factory, content);
2151 } 2234 }
2152 eina_iterator_free(it); 2235 eina_iterator_free(it);
2153 2236
@@ -2215,31 +2298,48 @@ _efl_ui_layout_efl_ui_factory_model_connect(Eo *obj EINA_UNUSED, Efl_Ui_Layout_D
2215 const char *name, Efl_Ui_Factory *factory) 2298 const char *name, Efl_Ui_Factory *factory)
2216{ 2299{
2217 EINA_SAFETY_ON_NULL_RETURN(name); 2300 EINA_SAFETY_ON_NULL_RETURN(name);
2301 Efl_Ui_Layout_Factory_Tracking *tracking;
2218 Eina_Stringshare *ss_name; 2302 Eina_Stringshare *ss_name;
2219 Efl_Ui_Factory *old_factory;
2220 Evas_Object *new_ev, *old_ev;
2221 2303
2222 if (!_elm_layout_part_aliasing_eval(obj, &name, EINA_TRUE)) 2304 if (!_elm_layout_part_aliasing_eval(obj, &name, EINA_TRUE))
2223 return; 2305 return;
2224 2306
2307 if (!pd->connect.factories)
2308 pd->connect.factories = eina_hash_stringshared_new(EINA_FREE_CB(_efl_ui_layout_factory_free));
2309
2225 ss_name = eina_stringshare_add(name); 2310 ss_name = eina_stringshare_add(name);
2226 2311
2227 if (!pd->connect.factories) 2312 // First undo the old one if there is one
2228 pd->connect.factories = eina_hash_stringshared_new(EINA_FREE_CB(efl_unref)); 2313 tracking = eina_hash_find(pd->connect.factories, ss_name);
2314 if (tracking)
2315 {
2316 Efl_Gfx_Entity *old;
2317
2318 // Unset and recycle
2319 old = elm_layout_content_get(obj, ss_name);
2320 elm_layout_content_set(obj, ss_name, NULL);
2321 if (old) efl_ui_factory_release(tracking->factory, old);
2229 2322
2230 new_ev = efl_ui_factory_create(factory, pd->connect.model, obj); 2323 // Stop in flight request
2231 EINA_SAFETY_ON_NULL_RETURN(new_ev); 2324 if (tracking->in_flight) eina_future_cancel(tracking->in_flight);
2232 2325
2233 old_factory = eina_hash_set(pd->connect.factories, ss_name, efl_ref(factory)); 2326 // Release previous factory
2234 if (old_factory) 2327 efl_replace(&tracking->factory, NULL);
2328 }
2329 else
2235 { 2330 {
2236 old_ev = elm_layout_content_get(obj, name); 2331 tracking = calloc(1, sizeof (Efl_Ui_Layout_Factory_Tracking));
2237 if (old_ev) 2332 if (!tracking) return ;
2238 efl_ui_factory_release(old_factory, old_ev); 2333
2239 efl_unref(old_factory); 2334 tracking->name = ss_name;
2335
2336 eina_hash_add(pd->connect.factories, ss_name, tracking);
2240 } 2337 }
2241 2338
2242 elm_layout_content_set(obj, name, new_ev); 2339 // And update content with the new factory
2340 tracking->factory = efl_ref(factory);
2341
2342 _efl_ui_layout_view_model_content_update(pd, tracking, ss_name);
2243} 2343}
2244 2344
2245EOLIAN static Eo * 2345EOLIAN static Eo *
diff --git a/src/lib/elementary/efl_ui_layout_factory.c b/src/lib/elementary/efl_ui_layout_factory.c
index cbd8139064..36bf8ddb5f 100644
--- a/src/lib/elementary/efl_ui_layout_factory.c
+++ b/src/lib/elementary/efl_ui_layout_factory.c
@@ -64,10 +64,11 @@ _efl_ui_layout_factory_efl_object_destructor(Eo *obj, Efl_Ui_Layout_Factory_Data
64 efl_destructor(efl_super(obj, MY_CLASS)); 64 efl_destructor(efl_super(obj, MY_CLASS));
65} 65}
66 66
67EOLIAN static Efl_Gfx_Entity * 67EOLIAN static Eina_Future *
68_efl_ui_layout_factory_efl_ui_factory_create(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Factory_Data *pd 68_efl_ui_layout_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Layout_Factory_Data *pd,
69 , Efl_Model *model, Efl_Gfx_Entity *parent) 69 Efl_Model *model, Efl_Gfx_Entity *parent)
70{ 70{
71 Eina_Value r;
71 Efl_Gfx_Entity *layout; 72 Efl_Gfx_Entity *layout;
72 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); 73 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
73 74
@@ -81,7 +82,9 @@ _efl_ui_layout_factory_efl_ui_factory_create(Eo *obj EINA_UNUSED, Efl_Ui_Layout_
81 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, 0); 82 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, 0);
82 evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL); 83 evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
83 84
84 return layout; 85 r = eina_value_object_init(layout);
86
87 return eina_future_resolved(efl_loop_future_scheduler_get(obj), r);
85} 88}
86 89
87EOLIAN static void 90EOLIAN static void
diff --git a/src/lib/elementary/efl_ui_list_view.c b/src/lib/elementary/efl_ui_list_view.c
index 5a9a764947..a4b74ab1c0 100644
--- a/src/lib/elementary/efl_ui_list_view.c
+++ b/src/lib/elementary/efl_ui_list_view.c
@@ -902,18 +902,25 @@ _efl_ui_list_view_efl_ui_widget_focus_state_apply(Eo *obj, Efl_Ui_List_View_Data
902 return efl_ui_widget_focus_state_apply(efl_super(obj, MY_CLASS), current_state, configured_state, obj); 902 return efl_ui_widget_focus_state_apply(efl_super(obj, MY_CLASS), current_state, configured_state, obj);
903} 903}
904 904
905EOLIAN static Efl_Ui_List_View_Layout_Item * 905typedef struct _Efl_Ui_List_Vuew_Layout_Item_Tracking Efl_Ui_List_View_Layout_Item_Tracking;
906_efl_ui_list_view_efl_ui_list_view_model_realize(Eo *obj, Efl_Ui_List_View_Data *pd, Efl_Ui_List_View_Layout_Item *item) 906struct _Efl_Ui_List_Vuew_Layout_Item_Tracking
907{ 907{
908 Efl_Ui_List_View_Layout_Item *item;
909 Eo *obj;
910 Efl_Ui_List_View_Data *pd;
911};
912
913static Eina_Value
914_content_created(void *data, const Eina_Value value)
915{
916 Efl_Ui_List_View_Layout_Item_Tracking *tracking = data;
917 Efl_Ui_List_View_Layout_Item *item = tracking->item;
918 Eo *obj = tracking->obj;
908 Efl_Ui_List_View_Item_Event evt; 919 Efl_Ui_List_View_Item_Event evt;
909 EINA_SAFETY_ON_NULL_RETURN_VAL(item, NULL);
910 920
911 if (!item->children) 921 eina_value_pget(&value, &item->layout);
912 return item;
913 922
914 item->layout = efl_ui_factory_create(pd->factory, item->children, obj); 923 evas_object_smart_member_add(item->layout, tracking->pd->pan_obj);
915 EINA_SAFETY_ON_NULL_RETURN_VAL(item->layout, NULL);
916 evas_object_smart_member_add(item->layout, pd->pan_obj);
917 evas_object_event_callback_add(item->layout, EVAS_CALLBACK_MOUSE_UP, _on_item_mouse_up, item); 924 evas_object_event_callback_add(item->layout, EVAS_CALLBACK_MOUSE_UP, _on_item_mouse_up, item);
918 925
919 if (_elm_config->atspi_mode) 926 if (_elm_config->atspi_mode)
@@ -929,6 +936,44 @@ _efl_ui_list_view_efl_ui_list_view_model_realize(Eo *obj, Efl_Ui_List_View_Data
929 efl_ui_focus_composition_dirty(obj); 936 efl_ui_focus_composition_dirty(obj);
930 937
931 evas_object_show(item->layout); 938 evas_object_show(item->layout);
939
940 return value;
941}
942
943static void
944_clean_request(void *data, const Eina_Future *dead_future EINA_UNUSED)
945{
946 Efl_Ui_List_View_Layout_Item_Tracking *tracking = data;
947
948 tracking->item->layout_request = NULL;
949 free(tracking);
950}
951
952EOLIAN static Efl_Ui_List_View_Layout_Item *
953_efl_ui_list_view_efl_ui_list_view_model_realize(Eo *obj, Efl_Ui_List_View_Data *pd, Efl_Ui_List_View_Layout_Item *item)
954{
955 Efl_Ui_List_View_Layout_Item_Tracking *tracking;
956 EINA_SAFETY_ON_NULL_RETURN_VAL(item->children, item);
957
958 if (!item->children) return item;
959
960 if (item->layout_request) eina_future_cancel(item->layout_request);
961
962 tracking = calloc(1, sizeof (Efl_Ui_List_View_Layout_Item_Tracking));
963 if (!tracking) return item;
964
965 tracking->item = item;
966 tracking->obj = obj;
967 tracking->pd = pd;
968
969 item->layout_request = efl_ui_factory_create(pd->factory, item->children, obj);
970 item->layout_request = efl_future_then(obj, item->layout_request);
971 item->layout_request = eina_future_then_from_desc(item->layout_request,
972 eina_future_cb_easy(.success = _content_created,
973 .success_type = EINA_VALUE_TYPE_OBJECT,
974 .data = tracking,
975 .free = _clean_request));
976
932 return item; 977 return item;
933} 978}
934 979
@@ -941,6 +986,13 @@ _efl_ui_list_view_efl_ui_list_view_model_unrealize(Eo *obj, Efl_Ui_List_View_Dat
941 if (!item->layout) 986 if (!item->layout)
942 return; 987 return;
943 988
989 // First check if the item has been fully realized
990 if (item->layout_request)
991 {
992 eina_future_cancel(item->layout_request);
993 return ;
994 }
995
944 evas_object_event_callback_del_full(item->layout, EVAS_CALLBACK_MOUSE_UP, _on_item_mouse_up, item); 996 evas_object_event_callback_del_full(item->layout, EVAS_CALLBACK_MOUSE_UP, _on_item_mouse_up, item);
945 if (elm_object_focus_allow_get(item->layout)) 997 if (elm_object_focus_allow_get(item->layout))
946 { 998 {
diff --git a/src/lib/elementary/efl_ui_list_view_seg_array.h b/src/lib/elementary/efl_ui_list_view_seg_array.h
index 2461534cc5..485398d469 100644
--- a/src/lib/elementary/efl_ui_list_view_seg_array.h
+++ b/src/lib/elementary/efl_ui_list_view_seg_array.h
@@ -1,8 +1,6 @@
1#ifndef EFL_UI_LIST_VIEW_SEG_ARRAY_H 1#ifndef EFL_UI_LIST_VIEW_SEG_ARRAY_H
2#define EFL_UI_LIST_VIEW_SEG_ARRAY_H 2#define EFL_UI_LIST_VIEW_SEG_ARRAY_H
3 3
4typedef struct _Efl_Ui_List_View_Item Efl_Ui_List_View_Item;
5
6typedef struct _Efl_Ui_List_View_SegArray_Node 4typedef struct _Efl_Ui_List_View_SegArray_Node
7{ 5{
8 EINA_RBTREE; 6 EINA_RBTREE;
diff --git a/src/lib/elementary/efl_ui_list_view_types.eot b/src/lib/elementary/efl_ui_list_view_types.eot
index f33bbf5b22..780dc202a6 100644
--- a/src/lib/elementary/efl_ui_list_view_types.eot
+++ b/src/lib/elementary/efl_ui_list_view_types.eot
@@ -1,5 +1,6 @@
1struct Efl.Ui.List_View_Layout_Item { 1struct Efl.Ui.List_View_Layout_Item {
2 layout: Efl.Ui.Layout; 2 layout: Efl.Ui.Layout;
3 layout_request: future<Efl.Ui.Layout>;
3 children: Efl.Model; 4 children: Efl.Model;
4 index_offset: int; 5 index_offset: int;
5 tree_node: void_ptr; 6 tree_node: void_ptr;