64{
71 int notify0_called = 0;
72 int notify1_called = 0;
73 int notify2_called = 0;
74 int notify3_called = 0;
75
76 switch (cmd) {
78 info->name =
"astobj2_weak1";
79 info->category =
"/main/astobj2/";
80 info->summary =
"Test ao2 weak objects";
81 info->description =
"Test ao2 weak objects.";
84 break;
85 }
86
89 if (!obj1) {
91 }
92
94 if (!weakref1) {
96 goto fail_cleanup;
97 }
99
102 goto fail_cleanup;
103 }
104 if (!notify0_called) {
106 goto fail_cleanup;
107 }
108
111 goto fail_cleanup;
112 }
113
116 goto fail_cleanup;
117 }
118
120 if (weakref1 != weakref2) {
122 goto fail_cleanup;
123 }
124
127 goto fail_cleanup;
128 }
129
132 goto fail_cleanup;
133 }
134
137 goto fail_cleanup;
138 }
139
142 goto fail_cleanup;
143 }
144
147
149 if (weakref1 != weakref2) {
152 goto fail_cleanup;
153 }
155
157 if (obj2) {
159
161 if (!ret) {
163 goto fail_cleanup;
164 }
165 }
166
169 goto fail_cleanup;
170 }
171
174 goto fail_cleanup;
175 }
176
179 goto fail_cleanup;
180 }
181
184 goto fail_cleanup;
185 }
186
189
190 if (obj1 != strong1) {
192 goto fail_cleanup;
193 }
194
197 goto fail_cleanup;
198 }
199
202
203 if (
destructor_called != 1 || notify1_called != 1 || notify2_called != 2 || notify3_called != 0) {
205 goto fail_cleanup;
206 }
207
210 goto fail_cleanup;
211 }
212
214 if (!obj3) {
216 goto fail_cleanup;
217 }
218
221 goto fail_cleanup;
222 }
223
226 "Expected -2 from ao2_t_weakproxy_ref_object against normal ao2 object.\n");
227 goto fail_cleanup;
228 }
229
232 goto fail_cleanup;
233 }
234
235 if (
ao2_t_ref(obj3, -1,
"balance weakref2 ref_object") != 3) {
237 goto fail_cleanup;
238 }
239
241
244 goto fail_cleanup;
245 }
246
248
252 }
253
255
256fail_cleanup:
261
263}
#define ao2_t_weakproxy_get_object(weakproxy, flags, tag)
int ao2_weakproxy_unsubscribe(void *weakproxy, ao2_weakproxy_notification_cb cb, void *data, int flags)
Remove notification of real object destruction.
int ao2_weakproxy_subscribe(void *weakproxy, ao2_weakproxy_notification_cb cb, void *data, int flags)
Request notification when weakproxy points to NULL.
#define ao2_t_ref(o, delta, tag)
#define ao2_t_get_weakproxy(obj, tag)
#define ao2_t_weakproxy_alloc(data_size, destructor_fn, tag)
#define ao2_t_weakproxy_ref_object(weakproxy, delta, flags, tag)
#define ao2_t_cleanup(obj, tag)
#define ao2_weakproxy_ref_object(weakproxy, delta, flags)
Run ao2_t_ref on the object associated with weakproxy.
#define ao2_t_weakproxy_set_object(weakproxy, obj, flags, tag)
#define ast_test_status_update(a, b, c...)
static void weakproxy_destructor(void *obj)
static int destructor_called
static int weakproxydestroyed
static void test_obj_destroy_notify(void *obj, void *data)
static void test_obj_destructor(void *obj)