summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2013-04-29 15:26:56 +0100
committerTom Hacohen <tom@stosb.com>2013-04-29 15:26:56 +0100
commitf79ddce412bf853c993d0c29a821eaeb48f1e9d4 (patch)
treefe5a0282996b5c14d714e7773d95a8266120f90d
parentc32fff36ff795ee862a1a52c86e823f4fe7e7349 (diff)
Clouseau: Move to eina_module instead of dlsym and close the handle.devs/tasn/clouseau_integration
-rw-r--r--src/lib/elm_main.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/lib/elm_main.c b/src/lib/elm_main.c
index 5c664a785..5960a8072 100644
--- a/src/lib/elm_main.c
+++ b/src/lib/elm_main.c
@@ -205,7 +205,7 @@ _prefix_shutdown(void)
205} 205}
206 206
207static struct { 207static struct {
208 void *handle; 208 Eina_Module *handle;
209 void (*init)(void); 209 void (*init)(void);
210 void (*shutdown)(void); 210 void (*shutdown)(void);
211 Eina_Bool (*app_connect)(const char *appname); 211 Eina_Bool (*app_connect)(const char *appname);
@@ -214,11 +214,11 @@ static struct {
214#define _CLOUSEAU_LOAD_SYMBOL(cls_struct, sym) \ 214#define _CLOUSEAU_LOAD_SYMBOL(cls_struct, sym) \
215 do \ 215 do \
216 { \ 216 { \
217 (cls_struct).sym = dlsym((cls_struct).handle, "clouseau_" #sym); \ 217 (cls_struct).sym = eina_module_symbol_get((cls_struct).handle, "clouseau_" #sym); \
218 if (!(cls_struct).sym) \ 218 if (!(cls_struct).sym) \
219 { \ 219 { \
220 WRN("Failed loading symbol '%s' from the clouseau library.", "clouseau_" #sym); \ 220 WRN("Failed loading symbol '%s' from the clouseau library.", "clouseau_" #sym); \
221 dlclose((cls_struct).handle); \ 221 eina_module_free((cls_struct).handle); \
222 (cls_struct).handle = NULL; \ 222 (cls_struct).handle = NULL; \
223 return EINA_FALSE; \ 223 return EINA_FALSE; \
224 } \ 224 } \
@@ -236,11 +236,13 @@ _clouseau_module_load()
236 if (!want_cls) 236 if (!want_cls)
237 return EINA_FALSE; 237 return EINA_FALSE;
238 238
239 const char *clouseau_lib = PACKAGE_LIB_DIR "/libclouseau" LIBEXT; 239 _clouseau_info.handle = eina_module_new(
240 _clouseau_info.handle = dlopen(clouseau_lib, RTLD_LAZY); 240 PACKAGE_LIB_DIR "/libclouseau" LIBEXT);
241 if (!_clouseau_info.handle) 241 if (!eina_module_load(_clouseau_info.handle))
242 { 242 {
243 WRN("Failed loading the clouseau library."); 243 WRN("Failed loading the clouseau library.");
244 eina_module_free(_clouseau_info.handle);
245 _clouseau_info.handle = NULL;
244 return EINA_FALSE; 246 return EINA_FALSE;
245 } 247 }
246 248
@@ -287,7 +289,11 @@ elm_shutdown(void)
287 while (_elm_win_deferred_free) ecore_main_loop_iterate(); 289 while (_elm_win_deferred_free) ecore_main_loop_iterate();
288 290
289 if (_clouseau_info.shutdown) 291 if (_clouseau_info.shutdown)
290 _clouseau_info.shutdown(); 292 {
293 _clouseau_info.shutdown();
294 eina_module_free(_clouseau_info.handle);
295 _clouseau_info.handle = NULL;
296 }
291// wrningz :( 297// wrningz :(
292// _prefix_shutdown(); 298// _prefix_shutdown();
293 if (app_name) 299 if (app_name)