diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2018-06-09 16:45:53 -0700 |
---|---|---|
committer | Matt Ranostay <matt.ranostay@konsulko.com> | 2018-06-10 02:06:52 +0000 |
commit | 81c3de066e8056d85946ec9c49b2c2d12a1ad8a9 (patch) | |
tree | d1037ee0c904099fcf1a80066a34d72f2fdad9aa /binding | |
parent | 7eb941f8b3734ea3d56b83af2a4b4e97f40dde23 (diff) |
There are edge conditions in which the media_result verb can be requested
before lms_proxy has been initialized which will cause a segfault.
This patchset reorders operations to be sure lms_proxy is initialized before
running returning from .init()
Bug-AGL: SPEC-1496
Change-Id: I160167e95b6e301aaaabc63efe08972976d18a63
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'binding')
-rw-r--r-- | binding/media-manager.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/binding/media-manager.c b/binding/media-manager.c index a1f228a..027072c 100644 --- a/binding/media-manager.c +++ b/binding/media-manager.c @@ -224,26 +224,23 @@ static int MediaPlayerDBusInit(void) return -1; } - g_signal_connect (MediaPlayerManage.lms_proxy, - "g-properties-changed", - G_CALLBACK (on_interface_proxy_properties_changed), - NULL); - return 0; } static void *media_event_loop_thread(void *unused) { GMainLoop *loop = g_main_loop_new(NULL, FALSE); - int ret; - ret = MediaPlayerDBusInit(); - if (ret == 0) { - LOGD("g_main_loop_run\n"); - g_main_loop_run(loop); - } + if (loop == NULL) + return NULL; - g_main_loop_unref(loop); + g_signal_connect (MediaPlayerManage.lms_proxy, + "g-properties-changed", + G_CALLBACK (on_interface_proxy_properties_changed), + NULL); + + LOGD("g_main_loop_run\n"); + g_main_loop_run(loop); return NULL; } @@ -284,6 +281,7 @@ int MediaPlayerManagerInit() { pthread_t thread_id; GFile *file; GFileMonitor *mon; + int ret; g_mutex_init(&(MediaPlayerManage.m)); @@ -294,9 +292,11 @@ int MediaPlayerManagerInit() { g_assert(mon != NULL); g_signal_connect (mon, "changed", G_CALLBACK(unmount_cb), NULL); - pthread_create(&thread_id, NULL, media_event_loop_thread, NULL); + ret = MediaPlayerDBusInit(); + if (ret == 0) + pthread_create(&thread_id, NULL, media_event_loop_thread, NULL); - return 0; + return ret; } /* |