spawn: fix reference counting of sequences
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
238dc06ae4
commit
ff46fd7e0a
4
spawn.c
4
spawn.c
|
@ -67,6 +67,7 @@ static void
|
||||||
spawn_monitor_timeout(struct ev_loop *loop, ev_timer *w, int revents)
|
spawn_monitor_timeout(struct ev_loop *loop, ev_timer *w, int revents)
|
||||||
{
|
{
|
||||||
spawn_sequence_remove(w->data);
|
spawn_sequence_remove(w->data);
|
||||||
|
sn_startup_sequence_unref(w->data);
|
||||||
p_delete(&w);
|
p_delete(&w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,6 +87,7 @@ spawn_monitor_event(SnMonitorEvent *event, void *data)
|
||||||
switch(event_type)
|
switch(event_type)
|
||||||
{
|
{
|
||||||
case SN_MONITOR_EVENT_INITIATED:
|
case SN_MONITOR_EVENT_INITIATED:
|
||||||
|
/* ref the sequence for the array */
|
||||||
sn_startup_sequence_ref(sequence);
|
sn_startup_sequence_ref(sequence);
|
||||||
SnStartupSequence_array_append(&sn_waits, sequence);
|
SnStartupSequence_array_append(&sn_waits, sequence);
|
||||||
lua_pushliteral(globalconf.L, "initiated");
|
lua_pushliteral(globalconf.L, "initiated");
|
||||||
|
@ -95,6 +97,8 @@ spawn_monitor_event(SnMonitorEvent *event, void *data)
|
||||||
* for ever */
|
* for ever */
|
||||||
struct ev_timer *ev_timeout = p_new(struct ev_timer, 1);
|
struct ev_timer *ev_timeout = p_new(struct ev_timer, 1);
|
||||||
ev_timer_init(ev_timeout, spawn_monitor_timeout, AWESOME_SPAWN_TIMEOUT, 0.);
|
ev_timer_init(ev_timeout, spawn_monitor_timeout, AWESOME_SPAWN_TIMEOUT, 0.);
|
||||||
|
/* ref the sequence for the callback event */
|
||||||
|
sn_startup_sequence_ref(sequence);
|
||||||
ev_timeout->data = sequence;
|
ev_timeout->data = sequence;
|
||||||
ev_timer_start(globalconf.loop, ev_timeout);
|
ev_timer_start(globalconf.loop, ev_timeout);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue