62 |
62 |
63 void ui_object_ref(UiObject *obj) { |
63 void ui_object_ref(UiObject *obj) { |
64 obj->ref++; |
64 obj->ref++; |
65 } |
65 } |
66 |
66 |
67 void ui_object_unref(UiObject *obj) { |
67 int ui_object_unref(UiObject *obj) { |
68 // it is possible to have 0 references, in case |
68 // it is possible to have 0 references, in case |
69 // a window was created but ui_show was never called |
69 // a window was created but ui_show was never called |
70 if(obj->ref == 0 || --obj->ref == 0) { |
70 if(obj->ref == 0 || --obj->ref == 0) { |
71 if(obj->destroy) { |
71 if(obj->destroy) { |
72 obj->destroy(obj); |
72 obj->destroy(obj); |
73 } else { |
|
74 uic_object_destroy(obj); |
|
75 } |
73 } |
|
74 uic_object_destroy(obj); |
|
75 return 0; |
76 } |
76 } |
|
77 return 1; |
77 } |
78 } |
78 |
79 |
79 void uic_object_destroy(UiObject *obj) { |
80 void uic_object_destroy(UiObject *obj) { |
80 if(obj->ctx->close_callback) { |
81 if(obj->ctx->close_callback) { |
81 UiEvent ev; |
82 UiEvent ev; |