| 101 |
101 |
| 102 int ui_object_unref(UiObject *obj) { |
102 int ui_object_unref(UiObject *obj) { |
| 103 // it is possible to have 0 references, in case |
103 // it is possible to have 0 references, in case |
| 104 // a window was created but ui_show was never called |
104 // a window was created but ui_show was never called |
| 105 if(obj->ref == 0 || --obj->ref == 0) { |
105 if(obj->ref == 0 || --obj->ref == 0) { |
| |
106 uic_context_prepare_close(obj->ctx); |
| 106 if(obj->destroy) { |
107 if(obj->destroy) { |
| 107 obj->destroy(obj); |
108 obj->destroy(obj); |
| 108 } else { |
109 } else { |
| 109 uic_object_destroy(obj); |
110 uic_object_destroy(obj); |
| 110 } |
111 } |
| 112 } |
113 } |
| 113 return 1; |
114 return 1; |
| 114 } |
115 } |
| 115 |
116 |
| 116 void uic_object_destroy(UiObject *obj) { |
117 void uic_object_destroy(UiObject *obj) { |
| 117 uic_context_prepare_close(obj->ctx); |
|
| 118 uic_object_destroyed(obj); |
118 uic_object_destroyed(obj); |
| 119 uic_context_destroy(obj->ctx, obj->ctx->document); |
119 uic_context_destroy(obj->ctx, obj->ctx->document); |
| 120 } |
120 } |
| 121 |
121 |
| 122 UiObject* uic_object_new_toplevel(void) { |
122 UiObject* uic_object_new_toplevel(void) { |