From 16efc8b6e2b9463852b09449eac041099fdc3130 Mon Sep 17 00:00:00 2001 From: Caiwen Zhang Date: Tue, 17 May 2016 09:24:39 +0800 Subject: [PATCH] gril: avoid glib runtime warning gril may be destroyed in the request callback (e.g in the callback of set modem power off request). 'out_queue' and 'command_queue' is NULL. there will be glib runtime warning if use them. --- gril/gril.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gril/gril.c b/gril/gril.c index 297a7720..a1c9661a 100644 --- a/gril/gril.c +++ b/gril/gril.c @@ -374,6 +374,12 @@ static void handle_response(struct ril_s *p, struct ril_msg *message) if (req->callback) req->callback(message, req->user_data); + /* gril may have been destroyed in the request callback */ + if (p->destroyed) { + ril_request_destroy(req); + return; + } + len = g_queue_get_length(p->out_queue); for (i = 0; i < len; i++) {