52 void ui_object_ref(UiObject *obj) { |
52 void ui_object_ref(UiObject *obj) { |
53 obj->ref++; |
53 obj->ref++; |
54 } |
54 } |
55 |
55 |
56 void ui_object_unref(UiObject *obj) { |
56 void ui_object_unref(UiObject *obj) { |
57 if(--obj->ref == 0) { |
57 // it is possible to have 0 references, in case |
|
58 // a window was created but ui_show was never called |
|
59 if(obj->ref == 0 || --obj->ref == 0) { |
58 if(obj->destroy) { |
60 if(obj->destroy) { |
59 obj->destroy(obj); |
61 obj->destroy(obj); |
60 } else { |
62 } else { |
61 uic_object_destroy(obj); |
63 uic_object_destroy(obj); |
62 } |
64 } |