summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2015-09-30 16:23:55 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2015-09-30 16:24:56 -0400
commit9fed51cf7932f311edbaeb9a10563e865c7ddd24 (patch)
tree4ab25cbbf354eaca70554d00c0c4bd4a221b8d44
parent5377478bbe61b1622fde428b7aa9d415350e6c99 (diff)
ecore-audio: defer deletion of pulseaudio timer until after event processing
==27523== Invalid write of size 8 ==27523== at 0x9E855F5: _ecore_time_wrapper (ecore_audio_pulse_ml.c:132) ==27523== by 0x647E5CF: _ecore_call_task_cb (ecore_private.h:336) ==27523== by 0x647FB8B: _ecore_timer_expired_call (ecore_timer.c:733) ==27523== by 0x647F9EE: _ecore_timer_expired_timers_call (ecore_timer.c:686) ==27523== by 0x647B4CE: _ecore_main_loop_iterate_internal (ecore_main.c:1814) ==27523== by 0x647998E: ecore_main_loop_begin (ecore_main.c:983) ==27523== by 0x4E4F676: elm_run (elm_main.c:1099) ==27523== by 0x12801B: elm_main (test.c:1010) ==27523== by 0x1280C4: main (test.c:1021) ==27523== Address 0x20537208 is 8 bytes inside a block of size 56 free'd ==27523== at 0x4A07D6A: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==27523== by 0x9E858ED: _ecore_pa_time_free (ecore_audio_pulse_ml.c:204) ==27523== by 0x108DB350: free_events (socket-client.c:109) ==27523== by 0x108DBA53: do_call (socket-client.c:157) ==27523== by 0x9E855F0: _ecore_time_wrapper (ecore_audio_pulse_ml.c:131) ==27523== by 0x647E5CF: _ecore_call_task_cb (ecore_private.h:336) ==27523== by 0x647FB8B: _ecore_timer_expired_call (ecore_timer.c:733) ==27523== by 0x647F9EE: _ecore_timer_expired_timers_call (ecore_timer.c:686) ==27523== by 0x647B4CE: _ecore_main_loop_iterate_internal (ecore_main.c:1814) ==27523== by 0x647998E: ecore_main_loop_begin (ecore_main.c:983) ==27523== by 0x4E4F676: elm_run (elm_main.c:1099) ==27523== by 0x12801B: elm_main (test.c:1010) ==27523== by 0x1280C4: main (test.c:1021) @fix
-rw-r--r--src/lib/ecore_audio/ecore_audio_pulse_ml.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/lib/ecore_audio/ecore_audio_pulse_ml.c b/src/lib/ecore_audio/ecore_audio_pulse_ml.c
index 11cf118ba9..841719ba0e 100644
--- a/src/lib/ecore_audio/ecore_audio_pulse_ml.c
+++ b/src/lib/ecore_audio/ecore_audio_pulse_ml.c
@@ -121,15 +121,34 @@ struct pa_time_event
121 121
122 pa_time_event_cb_t callback; 122 pa_time_event_cb_t callback;
123 pa_time_event_destroy_cb_t destroy_callback; 123 pa_time_event_destroy_cb_t destroy_callback;
124 Eina_Bool in_event : 1;
125 Eina_Bool dead : 1;
124}; 126};
125 127
128void
129_ecore_pa_time_free(pa_time_event *event)
130{
131 event->dead = 1;
132 if (event->in_event) return;
133 if (event->timer)
134 ecore_timer_del(event->timer);
135
136 event->timer = NULL;
137
138 free(event);
139}
140
126Eina_Bool 141Eina_Bool
127_ecore_time_wrapper(void *data) 142_ecore_time_wrapper(void *data)
128{ 143{
129 pa_time_event *event = (pa_time_event *)data; 144 pa_time_event *event = (pa_time_event *)data;
130 145
146 event->in_event = 1;
131 event->callback(event->mainloop, event, &event->tv, event->userdata); 147 event->callback(event->mainloop, event, &event->tv, event->userdata);
148 event->in_event = 0;
132 event->timer = NULL; 149 event->timer = NULL;
150 if (event->dead)
151 _ecore_pa_time_free(event);
133 return ECORE_CALLBACK_CANCEL; 152 return ECORE_CALLBACK_CANCEL;
134} 153}
135 154
@@ -194,17 +213,6 @@ _ecore_pa_time_restart(pa_time_event *event, const struct timeval *tv)
194} 213}
195 214
196void 215void
197_ecore_pa_time_free(pa_time_event *event)
198{
199 if (event->timer)
200 ecore_timer_del(event->timer);
201
202 event->timer = NULL;
203
204 free(event);
205}
206
207void
208_ecore_pa_time_set_destroy(pa_time_event *event, pa_time_event_destroy_cb_t cb) 216_ecore_pa_time_set_destroy(pa_time_event *event, pa_time_event_destroy_cb_t cb)
209{ 217{
210 event->destroy_callback = cb; 218 event->destroy_callback = cb;