summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorMinje Ahn <minje.ahn@samsung.com>2015-08-07 00:40:46 (GMT)
committerMinje Ahn <minje.ahn@samsung.com>2015-08-07 01:10:15 (GMT)
commit7adbb6954d7f05fd02b9cded3741ce6ed2c9226b (patch)
tree5315a9e75f2283f559b18a8375f093b6eca10a3e /server
parent41f405edc8f31d877615c580ed6eb308d7eaebec (diff)
downloadlibmedia-thumbnail-accepted/tizen/wearable/20150807.073442.zip
libmedia-thumbnail-accepted/tizen/wearable/20150807.073442.tar.gz
libmedia-thumbnail-accepted/tizen/wearable/20150807.073442.tar.bz2
Separate CMakeFiles for apply fPIE option Remove unused code Remove thumb_type Modify jpeg thumbnail creation logic when exif thumbnail is smaller than request thumbnail size Add scale down logic when request huge size image Fix bugs, memory leaks Remove unused parameters in function Change thumb path creation API position Remove thumbnail folder creation API Rename some functions Change-Id: I0e13d393dd524b61bcf44722c33b6f270649b732 Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
Diffstat (limited to 'server')
-rwxr-xr-xserver/CMakeLists.txt19
-rwxr-xr-xserver/include/thumb-server-internal.h12
-rwxr-xr-xserver/thumb-server-internal.c184
-rwxr-xr-xserver/thumb-server.c32
4 files changed, 124 insertions, 123 deletions
diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt
new file mode 100755
index 0000000..268e223
--- /dev/null
+++ b/server/CMakeLists.txt
@@ -0,0 +1,19 @@
+SET(THUMB-SERVER
+ ../src/util/media-thumb-db.c
+ ../src/media-thumb-internal.c
+ thumb-server.c
+ thumb-server-internal.c)
+
+INCLUDE(FindPkgConfig)
+ pkg_check_modules(pkgs REQUIRED glib-2.0 gthread-2.0 dlog mm-fileinfo aul libexif ecore-evas evas mmutil-imgp mmutil-jpeg libmedia-utils vconf libtzplatform-config)
+
+FOREACH(flag ${pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--hash-style=both -pie")
+
+ADD_EXECUTABLE(media-thumbnail-server ${THUMB-SERVER})
+TARGET_LINK_LIBRARIES(media-thumbnail-server ${pkgs_LDFLAGS} ${MEDIATHUMB-LIB} )
+INSTALL(TARGETS media-thumbnail-server DESTINATION ${BINDIR})
diff --git a/server/include/thumb-server-internal.h b/server/include/thumb-server-internal.h
index cd754e8..ac9a8ab 100755
--- a/server/include/thumb-server-internal.h
+++ b/server/include/thumb-server-internal.h
@@ -20,6 +20,7 @@
*/
#include <glib.h>
+#include <vconf.h>
#include "media-thumb-ipc.h"
#include "media-thumb-db.h"
@@ -47,8 +48,8 @@ gboolean _thumb_server_prepare_socket(int *sock_fd);
gboolean _thumb_server_read_socket(GIOChannel *src, GIOCondition condition, gpointer data);
int _thumbnail_get_data(const char *origin_path,
- media_thumb_type thumb_type,
media_thumb_format format,
+ char *thumb_path,
unsigned char **data,
int *size,
int *width,
@@ -56,18 +57,17 @@ int _thumbnail_get_data(const char *origin_path,
int *origin_width,
int *origin_height,
int *alpha,
- uid_t uid);
+ bool *is_saved);
int _thumbnail_get_raw_data(const char *origin_path,
media_thumb_format format,
- unsigned char **data,
- int *size,
int *width,
int *height,
- uid_t uid);
+ unsigned char **data,
+ int *size);
int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid);
-int _media_thumb_process_raw(thumbMsg *req_msg, thumbMsg *res_msg, thumbRawAddMsg *res_raw_msg, uid_t uid);
+int _media_thumb_process_raw(thumbMsg *req_msg, thumbMsg *res_msg, thumbRawAddMsg *res_raw_msg);
#endif /*_THUMB_DAEMON_INTERNAL_H_*/
diff --git a/server/thumb-server-internal.c b/server/thumb-server-internal.c
index de7f8fd..c2f32c7 100755
--- a/server/thumb-server-internal.c
+++ b/server/thumb-server-internal.c
@@ -19,6 +19,7 @@
*
*/
+ #define _GNU_SOURCE
#include "thumb-server-internal.h"
#include "media-thumb-util.h"
#include "media-thumb-debug.h"
@@ -38,6 +39,8 @@
#endif
#define LOG_TAG "MEDIA_THUMBNAIL_SERVER"
+#define THUMB_DEFAULT_WIDTH 320
+#define THUMB_DEFAULT_HEIGHT 240
#define THUMB_BLOCK_SIZE 512
static __thread char **arr_path;
@@ -177,11 +180,11 @@ int _thumb_daemon_process_job(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid)
return err;
}
-static int __thumb_daemon_process_job_raw(thumbMsg *req_msg, thumbMsg *res_msg, thumbRawAddMsg *res_raw_msg, uid_t uid)
+static int __thumb_daemon_process_job_raw(thumbMsg *req_msg, thumbMsg *res_msg, thumbRawAddMsg *res_raw_msg)
{
int err = MS_MEDIA_ERR_NONE;
- err = _media_thumb_process_raw(req_msg, res_msg, res_raw_msg, uid);
+ err = _media_thumb_process_raw(req_msg, res_msg, res_raw_msg);
if (err != MS_MEDIA_ERR_NONE) {
if (err != MS_MEDIA_ERR_FILE_NOT_EXIST) {
thumb_warn("_media_thumb_process is failed: %d, So use default thumb", err);
@@ -278,31 +281,33 @@ int _thumb_daemon_process_queue_jobs(gpointer data)
memset(&res_msg, 0x00, sizeof(thumbMsg));
recv_msg.msg_type = THUMB_REQUEST_DB_INSERT;
- recv_msg.thumb_type = MEDIA_THUMB_LARGE;
strncpy(recv_msg.org_path, path, sizeof(recv_msg.org_path));
recv_msg.org_path[sizeof(recv_msg.org_path) - 1] = '\0';
- _thumb_daemon_process_job(&recv_msg, &res_msg,uid );
+ err = _thumb_daemon_process_job(&recv_msg, &res_msg,uid );
+ if (err == MS_MEDIA_ERR_FILE_NOT_EXIST) {
+ thumb_err("Thumbnail processing is failed : %d", err);
+ } else {
+ if (res_msg.status == THUMB_SUCCESS) {
- if (res_msg.status == THUMB_SUCCESS) {
+ err = _media_thumb_db_connect(uid);
+ if (err != MS_MEDIA_ERR_NONE) {
+ thumb_err("_media_thumb_mb_svc_connect failed: %d", err);
+ return TRUE;
+ }
- err = _media_thumb_db_connect(uid);
- if (err != MS_MEDIA_ERR_NONE) {
- thumb_err("_media_thumb_mb_svc_connect failed: %d", err);
- return TRUE;
- }
+ /* Need to update DB once generating thumb is done */
+ err = _media_thumb_update_db(recv_msg.org_path,
+ res_msg.dst_path,
+ res_msg.origin_width,
+ res_msg.origin_height,
+ uid);
+ if (err != MS_MEDIA_ERR_NONE) {
+ thumb_err("_media_thumb_update_db failed : %d", err);
+ }
- /* Need to update DB once generating thumb is done */
- err = _media_thumb_update_db(recv_msg.org_path,
- res_msg.dst_path,
- res_msg.origin_width,
- res_msg.origin_height,
- uid);
- if (err < 0) {
- thumb_err("_media_thumb_update_db failed : %d", err);
+ _media_thumb_db_disconnect();
}
-
- _media_thumb_db_disconnect();
}
SAFE_FREE(path);
@@ -328,7 +333,6 @@ gboolean _thumb_server_read_socket(GIOChannel *src,
{
struct sockaddr_un client_addr;
unsigned int client_addr_len;
- int client_sock;
thumbMsg recv_msg;
thumbMsg res_msg;
thumbRawAddMsg res_raw_msg;
@@ -353,14 +357,14 @@ gboolean _thumb_server_read_socket(GIOChannel *src,
return TRUE;
}
- thumb_warn("Received [%d] %s(%d) from PID(%d) \n", recv_msg.msg_type, recv_msg.org_path, strlen(recv_msg.org_path), recv_msg.pid);
+ thumb_warn_slog("Received [%d] %s(%d) from PID(%d)", recv_msg.msg_type, recv_msg.org_path, strlen(recv_msg.org_path), recv_msg.pid);
if (recv_msg.msg_type == THUMB_REQUEST_ALL_MEDIA) {
thumb_dbg("All thumbnails are being extracted now");
_thumb_daemon_all_extract(recv_msg.uid);
g_idle_add(_thumb_daemon_process_queue_jobs, NULL);
} else if(recv_msg.msg_type == THUMB_REQUEST_RAW_DATA) {
- __thumb_daemon_process_job_raw(&recv_msg, &res_msg, &res_raw_msg, recv_msg.uid);
+ __thumb_daemon_process_job_raw(&recv_msg, &res_msg, &res_raw_msg);
} else if(recv_msg.msg_type == THUMB_REQUEST_KILL_SERVER) {
thumb_warn("received KILL msg from thumbnail agent.");
} else {
@@ -480,24 +484,6 @@ gboolean _thumb_server_prepare_socket(int *sock_fd)
return TRUE;
}
-static int _mkdir(const char *dir, mode_t mode) {
- char tmp[256];
- char *p = NULL;
- size_t len;
-
- snprintf(tmp, sizeof(tmp),"%s",dir);
- len = strlen(tmp);
- if(tmp[len - 1] == '/')
- tmp[len - 1] = 0;
- for(p = tmp + 1; *p; p++)
- if(*p == '/') {
- *p = 0;
- mkdir(tmp, mode);
- *p = '/';
- }
- return mkdir(tmp, mode);
-}
-
static char* _media_thumb_get_default_path(uid_t uid)
{
char *result_psswd = NULL;
@@ -533,15 +519,12 @@ static char* _media_thumb_get_default_path(uid_t uid)
asprintf(&result_psswd, "%s/data/file-manager-service/.thumb/phone", userinfo->pw_dir);
}
- /* create dir */
- _mkdir(result_psswd,S_IRWXU | S_IRWXG | S_IRWXO);
-
return result_psswd;
}
-int _thumbnail_get_data(const char *origin_path,
- media_thumb_type thumb_type,
- media_thumb_format format,
+int _thumbnail_get_data(const char *origin_path,
+ media_thumb_format format,
+ char *thumb_path,
unsigned char **data,
int *size,
int *width,
@@ -549,7 +532,7 @@ int _thumbnail_get_data(const char *origin_path,
int *origin_width,
int *origin_height,
int *alpha,
- uid_t uid)
+ bool *is_saved)
{
int err = MS_MEDIA_ERR_NONE;
int thumb_width = -1;
@@ -572,37 +555,33 @@ int _thumbnail_get_data(const char *origin_path,
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
- thumb_width = _media_thumb_get_width(thumb_type);
- if (thumb_width < 0) {
- thumb_err("media_thumb_type is invalid");
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
- thumb_height = _media_thumb_get_height(thumb_type);
- if (thumb_height < 0) {
- thumb_err("media_thumb_type is invalid");
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
thumb_dbg("Origin path : %s", origin_path);
int file_type = THUMB_NONE_TYPE;
media_thumb_info thumb_info = {0,};
file_type = _media_thumb_get_file_type(origin_path);
+ thumb_width = *width;
+ thumb_height = *height;
+ if(thumb_width == 0) {
+ thumb_width = THUMB_DEFAULT_WIDTH;
+ thumb_height = THUMB_DEFAULT_HEIGHT;
+ }
if (file_type == THUMB_IMAGE_TYPE) {
- err = _media_thumb_image(origin_path, thumb_width, thumb_height, format, &thumb_info, false, uid);
+ err = _media_thumb_image(origin_path, thumb_path, thumb_width, thumb_height, format, &thumb_info, FALSE);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_media_thumb_image failed");
return err;
}
-
} else if (file_type == THUMB_VIDEO_TYPE) {
- err = _media_thumb_video(origin_path, thumb_width, thumb_height, format, &thumb_info,uid);
+ err = _media_thumb_video(origin_path, thumb_width, thumb_height, format, &thumb_info);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_media_thumb_image failed");
return err;
}
+ } else {
+ thumb_err("invalid file type");
+ return MS_MEDIA_ERR_INVALID_PARAMETER;
}
if (size) *size = thumb_info.size;
@@ -612,6 +591,7 @@ int _thumbnail_get_data(const char *origin_path,
if (origin_width) *origin_width = thumb_info.origin_width;
if (origin_height) *origin_height = thumb_info.origin_height;
if (alpha) *alpha = thumb_info.alpha;
+ if (is_saved) *is_saved= thumb_info.is_saved;
thumb_dbg("Thumb data is generated successfully (Size:%d, W:%d, H:%d) 0x%x",
*size, *width, *height, *data);
@@ -621,15 +601,15 @@ int _thumbnail_get_data(const char *origin_path,
int _thumbnail_get_raw_data(const char *origin_path,
media_thumb_format format,
- unsigned char **data,
- int *size,
int *width,
int *height,
- uid_t uid)
+ unsigned char **data,
+ int *size)
{
int err = MS_MEDIA_ERR_NONE;
int thumb_width = -1;
int thumb_height = -1;
+ const char * thumb_path = NULL;
if (origin_path == NULL || *width <= 0 || *height <= 0) {
thumb_err("Invalid parameter");
@@ -647,7 +627,7 @@ int _thumbnail_get_raw_data(const char *origin_path,
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
- thumb_dbg("Origin path : %s", origin_path);
+// thumb_dbg_slog("Origin path : %s", origin_path);
int file_type = THUMB_NONE_TYPE;
media_thumb_info thumb_info = {0,};
@@ -656,23 +636,26 @@ int _thumbnail_get_raw_data(const char *origin_path,
thumb_height = *height;
if (file_type == THUMB_IMAGE_TYPE) {
- err = _media_thumb_image(origin_path, thumb_width, thumb_height, format, &thumb_info, true, uid);
+ err = _media_thumb_image(origin_path, thumb_path, thumb_width, thumb_height, format, &thumb_info, TRUE);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_media_thumb_image failed");
return err;
}
} else if (file_type == THUMB_VIDEO_TYPE) {
- err = _media_thumb_video(origin_path, thumb_width, thumb_height, format, &thumb_info,uid);
+ err = _media_thumb_video(origin_path, thumb_width, thumb_height, format, &thumb_info);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_media_thumb_image failed");
return err;
}
+ } else {
+ thumb_err("invalid file type");
+ return MS_MEDIA_ERR_INVALID_PARAMETER;
}
if (size) *size = thumb_info.size;
- if (width) *width = thumb_info.width;
- if (height) *height = thumb_info.height;
*data = thumb_info.data;
+ *width = thumb_info.width;
+ *height = thumb_info.height;
//thumb_dbg("Thumb data is generated successfully (Size:%d, W:%d, H:%d) 0x%x", *size, *width, *height, *data);
@@ -692,6 +675,7 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid)
char *thumb_path = NULL;
int need_update_db = 0;
int alpha = 0;
+ bool is_saved = FALSE;
if (req_msg == NULL || res_msg == NULL) {
thumb_err("Invalid msg!");
@@ -699,18 +683,24 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid)
}
int msg_type = req_msg->msg_type;
- media_thumb_type thumb_type = req_msg->thumb_type;
const char *origin_path = req_msg->org_path;
media_thumb_format thumb_format = MEDIA_THUMB_BGRA;
+ thumb_w = req_msg->thumb_width;
+ thumb_h = req_msg->thumb_height;
thumb_path = res_msg->dst_path;
thumb_path[0] = '\0';
max_length = sizeof(res_msg->dst_path);
+ if (!g_file_test(origin_path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
+ thumb_err("origin_path does not exist in file system.");
+ return MS_MEDIA_ERR_FILE_NOT_EXIST;
+ }
+
err = _media_thumb_db_connect(uid);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_media_thumb_mb_svc_connect failed: %d", err);
- return MS_MEDIA_ERR_DB_CONNECT_FAIL;
+ return err;
}
if (msg_type == THUMB_REQUEST_DB_INSERT) {
@@ -726,7 +716,7 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid)
if (err != MS_MEDIA_ERR_NONE) {
char *default_path = _media_thumb_get_default_path(uid);
if(default_path) {
- thumb_err("_media_thumb_get_hash_name failed - %d\n", err);
+ thumb_err("_media_thumb_get_hash_name failed - %d", err);
strncpy(thumb_path, default_path, max_length);
free(default_path);
}
@@ -746,7 +736,7 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid)
if (err != MS_MEDIA_ERR_NONE) {
char *default_path = _media_thumb_get_default_path(uid);
if(default_path) {
- thumb_err("_media_thumb_get_hash_name failed - %d\n", err);
+ thumb_err("_media_thumb_get_hash_name failed - %d", err);
strncpy(thumb_path, default_path, max_length);
free(default_path);
}
@@ -764,17 +754,19 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid)
_media_thumb_remove_file(thumb_path);
}
- err = _thumbnail_get_data(origin_path, thumb_type, thumb_format, &data, &thumb_size, &thumb_w, &thumb_h, &origin_w, &origin_h, &alpha, uid);
+ err = _thumbnail_get_data(origin_path, thumb_format, thumb_path, &data, &thumb_size, &thumb_w, &thumb_h, &origin_w, &origin_h, &alpha, &is_saved);
if (err != MS_MEDIA_ERR_NONE) {
char *default_path = _media_thumb_get_default_path(uid);
thumb_err("_thumbnail_get_data failed - %d", err);
SAFE_FREE(data);
+
if(default_path) {
strncpy(thumb_path, default_path, max_length);
free(default_path);
}
- _media_thumb_db_disconnect();
- return err;
+ goto DB_UPDATE;
+// _media_thumb_db_disconnect();
+// return err;
}
//thumb_dbg("Size : %d, W:%d, H:%d", thumb_size, thumb_w, thumb_h);
@@ -798,25 +790,29 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid)
thumb_path[len - 2] = 'n';
thumb_path[len - 1] = 'g';
}
- thumb_dbg("Thumb path is changed : %s", thumb_path);
+ thumb_dbg_slog("Thumb path is changed : %s", thumb_path);
}
- err = _media_thumb_save_to_file_with_evas(data, thumb_w, thumb_h, alpha, thumb_path);
- if (err != MS_MEDIA_ERR_NONE) {
- char *default_path = _media_thumb_get_default_path(uid);
- thumb_err("save_to_file_with_evas failed - %d", err);
- SAFE_FREE(data);
+ if (is_saved == FALSE && data != NULL) {
+ err = _media_thumb_save_to_file_with_evas(data, thumb_w, thumb_h, alpha, thumb_path);
+ if (err != MS_MEDIA_ERR_NONE) {
+ char *default_path = _media_thumb_get_default_path(uid);
+ thumb_err("save_to_file_with_evas failed - %d", err);
+ SAFE_FREE(data);
- if (msg_type == THUMB_REQUEST_DB_INSERT || msg_type == THUMB_REQUEST_ALL_MEDIA) {
- if(default_path) {
- strncpy(thumb_path, default_path, max_length);
- free(default_path);
+ if (msg_type == THUMB_REQUEST_DB_INSERT || msg_type == THUMB_REQUEST_ALL_MEDIA) {
+ if(default_path) {
+ strncpy(thumb_path, default_path, max_length);
+ free(default_path);
+ }
}
+ _media_thumb_db_disconnect();
+ return err;
+ } else {
+ thumb_dbg("file save success");
}
- _media_thumb_db_disconnect();
- return err;
} else {
- thumb_dbg("file save success");
+ thumb_dbg("file is already saved");
}
/* fsync */
@@ -835,7 +831,7 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid)
/* End of fsync */
SAFE_FREE(data);
-
+DB_UPDATE:
/* DB update if needed */
if (need_update_db == 1) {
err = _media_thumb_update_db(origin_path, thumb_path, res_msg->origin_width, res_msg->origin_height, uid);
@@ -850,7 +846,7 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid)
}
int
-_media_thumb_process_raw(thumbMsg *req_msg, thumbMsg *res_msg, thumbRawAddMsg *res_raw_msg, uid_t uid)
+_media_thumb_process_raw(thumbMsg *req_msg, thumbMsg *res_msg, thumbRawAddMsg *res_raw_msg)
{
int err = MS_MEDIA_ERR_NONE;
unsigned char *data = NULL;
@@ -876,7 +872,7 @@ _media_thumb_process_raw(thumbMsg *req_msg, thumbMsg *res_msg, thumbRawAddMsg *r
return MS_MEDIA_ERR_FILE_NOT_EXIST;
}
- err = _thumbnail_get_raw_data(origin_path, thumb_format, &data, &thumb_size, &thumb_w, &thumb_h, uid);
+ err = _thumbnail_get_raw_data(origin_path, thumb_format, &thumb_w, &thumb_h, &data, &thumb_size);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_thumbnail_get_data failed - %d", err);
diff --git a/server/thumb-server.c b/server/thumb-server.c
index b64a3d6..3a9a113 100755
--- a/server/thumb-server.c
+++ b/server/thumb-server.c
@@ -25,7 +25,6 @@
#include "media-thumb-util.h"
#include "thumb-server-internal.h"
#include <pthread.h>
-#include <heynoti.h>
#include <vconf.h>
#ifdef LOG_TAG
@@ -33,10 +32,10 @@
#endif
#define LOG_TAG "MEDIA_THUMBNAIL_SERVER"
-#define POWEROFF_NOTI_NAME "power_off_start" /*poeroff noti from system-server*/
extern GMainLoop *g_thumb_server_mainloop;
+#if 0
static void _media_thumb_signal_handler(void *user_data)
{
thumb_dbg("Singal Hander for HEYNOTI \"power_off_start\"");
@@ -48,32 +47,17 @@ static void _media_thumb_signal_handler(void *user_data)
return;
}
+#endif
int main(void)
{
int sockfd = -1;
+ int err = 0;
GSource *source = NULL;
GIOChannel *channel = NULL;
GMainContext *context = NULL;
- /*heynoti for power off*/
- int err = 0;
- int heynoti_id = heynoti_init();
-
- if (heynoti_id < 0) {
- thumb_err("heynoti_init failed");
- } else {
- err = heynoti_subscribe(heynoti_id, POWEROFF_NOTI_NAME, _media_thumb_signal_handler, NULL);
- if (err < 0) {
- thumb_err("heynoti_attach_handler failed: %d", err);
- } else {
- err = heynoti_attach_handler(heynoti_id);
- if (err < 0)
- thumb_err("heynoti_attach_handler failed: %d", err);
- }
- }
-
/* Set VCONFKEY_SYSMAN_MMC_FORMAT callback to get noti for SD card format */
err = vconf_notify_key_changed(VCONFKEY_SYSMAN_MMC_FORMAT, (vconf_callback_fn) _thumb_daemon_vconf_cb, NULL);
if (err == -1)
@@ -91,6 +75,7 @@ int main(void)
}
g_thumb_server_mainloop = g_main_loop_new(context, FALSE);
+ context = g_main_loop_get_context(g_thumb_server_mainloop);
/* Create new channel to watch udp socket */
channel = g_io_channel_unix_new(sockfd);
@@ -100,10 +85,10 @@ int main(void)
g_source_set_callback(source, (GSourceFunc)_thumb_server_read_socket, NULL, NULL);
g_source_attach(source, context);
- GSource *source_init = NULL;
- source_init = g_idle_source_new ();
- g_source_set_callback (source_init, _thumb_daemon_start_jobs, NULL, NULL);
- g_source_attach (source_init, context);
+ GSource *source_evas_init = NULL;
+ source_evas_init = g_idle_source_new ();
+ g_source_set_callback (source_evas_init, _thumb_daemon_start_jobs, NULL, NULL);
+ g_source_attach (source_evas_init, context);
/* Would be used when glib 2.32 is installed
GSource *sig_handler_src = NULL;
@@ -121,6 +106,7 @@ int main(void)
g_io_channel_shutdown(channel, FALSE, NULL);
g_io_channel_unref(channel);
_thumb_daemon_finish_jobs();
+ g_main_loop_unref(g_thumb_server_mainloop);
return 0;
}