eina_log: reset logging callback to default when null is set as the callback
authorMike Blumenkrantz <zmike@samsung.com>
Fri, 29 Mar 2019 17:50:30 +0000 (18:50 +0100)
committerJunsuChoi <jsuya.choi@samsung.com>
Tue, 2 Apr 2019 04:24:22 +0000 (13:24 +0900)
Summary:
passing null here causes any log message to crash the app and is probably not
the intended result

Reviewers: cedric, segfaultxavi

Reviewed By: cedric, segfaultxavi

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8513

src/lib/eina/eina_log.c

index 1e55f6b..807efbc 100644 (file)
@@ -1752,7 +1752,10 @@ eina_log_print_cb_set(Eina_Log_Print_Cb cb, void *data)
 {
 #ifdef EINA_ENABLE_LOG
    LOG_LOCK();
-   _print_cb = cb;
+   if (cb)
+     _print_cb = cb;
+   else
+     _print_cb = eina_log_print_cb_stderr;
    _print_cb_data = data;
    eina_log_print_prefix_update();
    LOG_UNLOCK();