summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSeonah Moon <seonah1.moon@samsung.com>2020-04-07 16:17:22 +0900
committerSeonah Moon <seonah1.moon@samsung.com>2020-04-07 16:17:22 +0900
commitf56190a6b8b43009658728b1a1e8a48a0a290a9a (patch)
tree0a6392e60bd602d364f3cb81992c2a5d69a031fa /src
parentba9924b854314036279be714f7fff193620b56fb (diff)
downloadwifi-aware-f56190a6b8b43009658728b1a1e8a48a0a290a9a.tar.gz
wifi-aware-f56190a6b8b43009658728b1a1e8a48a0a290a9a.tar.bz2
wifi-aware-f56190a6b8b43009658728b1a1e8a48a0a290a9a.zip
Prevent segmentaion fault when invoking callback function
Diffstat (limited to 'src')
-rw-r--r--src/wifi-aware-data-path.c3
-rw-r--r--src/wifi-aware-private.c9
2 files changed, 8 insertions, 4 deletions
diff --git a/src/wifi-aware-data-path.c b/src/wifi-aware-data-path.c
index 9a953c7..949f9aa 100644
--- a/src/wifi-aware-data-path.c
+++ b/src/wifi-aware-data-path.c
@@ -216,9 +216,10 @@ static void __data_path_invoke_callback(wifi_aware_data_path_h data_path, wifi_a
wifi_aware_data_path_s *ndp = (wifi_aware_data_path_s *)data_path;
if (ndp->open_cb) {
- ndp->open_cb(data_path, error, ndp->open_cb_user_data);
+ wifi_aware_data_path_open_cb open_cb = ndp->open_cb;
ndp->open_cb = NULL;
ndp->open_cb_user_data = NULL;
+ open_cb(data_path, error, ndp->open_cb_user_data);
}
}
diff --git a/src/wifi-aware-private.c b/src/wifi-aware-private.c
index 4da7288..fed3294 100644
--- a/src/wifi-aware-private.c
+++ b/src/wifi-aware-private.c
@@ -239,9 +239,10 @@ static void __enable_request_reply(GObject *src, GAsyncResult *res, gpointer use
}
if (g_wifi_aware->enabled_cb) {
- g_wifi_aware->enabled_cb(error, g_wifi_aware->enabled_cb_data);
+ wifi_aware_enabled_cb enabled_cb = g_wifi_aware->enabled_cb;
g_wifi_aware->enabled_cb = NULL;
g_wifi_aware->enabled_cb_data = NULL;
+ enabled_cb(error, g_wifi_aware->enabled_cb_data);
}
}
@@ -272,9 +273,10 @@ static void __wifi_aware_publish_invoke_callback(wifi_aware_session_h session,
wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
if (handle->published_cb) {
- handle->published_cb(session, error, handle->published_cb_data);
+ wifi_aware_published_cb published_cb = handle->published_cb;
handle->published_cb = NULL;
handle->published_cb_data = NULL;
+ published_cb(session, error, handle->published_cb_data);
}
}
@@ -370,9 +372,10 @@ static void __wifi_aware_subscribe_invoke_callback(wifi_aware_session_h session,
wifi_aware_session_s *handle = (wifi_aware_session_s *)session;
if (handle->subscribed_cb) {
- handle->subscribed_cb(session, error, handle->subscribed_cb_data);
+ wifi_aware_subscribed_cb subscribed_cb = handle->subscribed_cb;
handle->subscribed_cb = NULL;
handle->subscribed_cb_data = NULL;
+ subscribed_cb(session, error, handle->subscribed_cb_data);
}
}