@@ -81,8 +81,6 @@ struct rtpp_timed_wi {
8181 double when ;
8282 double offset ;
8383 struct rtpp_timed_cf * timed_cf ;
84- struct rtpp_wi * wi ;
85- void * rco [0 ];
8684};
8785
8886static void rtpp_timed_destroy (struct rtpp_timed_cf * );
@@ -95,8 +93,6 @@ static void rtpp_timed_process(struct rtpp_timed_cf *, double);
9593static int rtpp_timed_cancel (struct rtpp_timed_task * );
9694static void rtpp_timed_shutdown (struct rtpp_timed * );
9795
98- static void rtpp_timed_task_dtor (struct rtpp_timed_wi * );
99-
10096DEFINE_SMETHODS (rtpp_timed ,
10197 .schedule = & rtpp_timed_schedule ,
10298 .schedule_rc = rtpp_timed_schedule_rc ,
@@ -238,12 +234,7 @@ rtpp_timed_schedule_base(struct rtpp_timed *pub, double offset,
238234 return (NULL );
239235 }
240236 memset (wi_data , '\0' , rtpp_timed_cf -> wi_dsize );
241- wi_data -> wi = wi ;
242- wi_data -> pub .rcnt = rtpp_refcnt_ctor_pa (& wi_data -> rco [0 ], NULL );
243- if (wi_data -> pub .rcnt == NULL ) {
244- RTPP_OBJ_DECREF (wi );
245- return (NULL );
246- }
237+ wi_data -> pub .rcnt = wi -> rcnt ;
247238 wi_data -> cb .func = cb_func ;
248239 wi_data -> cb .arg = cb_func_arg ;
249240 wi_data -> cancel_cb .func = cancel_cb_func ;
@@ -254,15 +245,18 @@ rtpp_timed_schedule_base(struct rtpp_timed *pub, double offset,
254245 if (callback_rcnt != NULL ) {
255246 RC_INCREF (callback_rcnt );
256247 }
248+ #if defined(RTPP_DEBUG )
249+ RTPP_OBJ_DTOR_ATTACH (wi , (rtpp_refcnt_dtor_t )& rtpp_timed_task_fin ,
250+ & (wi_data -> pub ));
251+ #endif
257252 if (support_cancel != 0 ) {
258253 wi_data -> pub .cancel = & rtpp_timed_cancel ;
259254 wi_data -> timed_cf = rtpp_timed_cf ;
260255 RTPP_OBJ_INCREF (pub );
256+ RTPP_OBJ_DTOR_ATTACH_RC (wi , pub -> rcnt );
261257 }
262- RTPP_OBJ_INCREF (& ( wi_data -> pub ) );
258+ RTPP_OBJ_INCREF (wi );
263259 rtpp_queue_put_item (wi , rtpp_timed_cf -> q );
264- CALL_SMETHOD (wi_data -> pub .rcnt , attach , (rtpp_refcnt_dtor_t )& rtpp_timed_task_dtor ,
265- wi_data );
266260 return (& (wi_data -> pub ));
267261}
268262
@@ -368,17 +362,6 @@ rtpp_timed_match_wi(struct rtpp_wi *wia, void *p)
368362 return (1 );
369363}
370364
371- static void
372- rtpp_timed_task_dtor (struct rtpp_timed_wi * wi_data )
373- {
374-
375- rtpp_timed_task_fin (& (wi_data -> pub ));
376- if (wi_data -> timed_cf != NULL ) {
377- RTPP_OBJ_DECREF (& (wi_data -> timed_cf -> pub ));
378- }
379- RTPP_OBJ_DECREF (wi_data -> wi );
380- }
381-
382365static int
383366rtpp_timed_cancel (struct rtpp_timed_task * taskpub )
384367{
0 commit comments