summaryrefslogtreecommitdiff
path: root/legacy/eio
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2012-08-28 05:49:38 +0000
committerVincent Torri <vincent.torri@gmail.com>2012-08-28 05:49:38 +0000
commit83f7a57d50cbf5ccf451a2e3ea83ea2497ab8c1f (patch)
treef5b437ec24e97802ea7e551479436d58cf978ede /legacy/eio
parentc20db5be17a66f28c5c91b482ce6eccc131515f2 (diff)
Eio: Do not free Windows stuff when it is not used. Fix seg fault.
SVN revision: 75747
Diffstat (limited to 'legacy/eio')
-rw-r--r--legacy/eio/ChangeLog4
-rw-r--r--legacy/eio/NEWS2
-rw-r--r--legacy/eio/src/lib/eio_monitor_win32.c18
3 files changed, 18 insertions, 6 deletions
diff --git a/legacy/eio/ChangeLog b/legacy/eio/ChangeLog
index d78efeaa43..894d602c46 100644
--- a/legacy/eio/ChangeLog
+++ b/legacy/eio/ChangeLog
@@ -22,3 +22,7 @@
22 22
23 * Add a comment describing the false positiv detected by static analyzer 23 * Add a comment describing the false positiv detected by static analyzer
24 when calling eio_file_set. 24 when calling eio_file_set.
25
262012-08-07 Vincent Torri
27
28 * Do not free Windows stuff when it is not used. Fix seg fault
diff --git a/legacy/eio/NEWS b/legacy/eio/NEWS
index 5874fa2ce5..1478343f5f 100644
--- a/legacy/eio/NEWS
+++ b/legacy/eio/NEWS
@@ -10,8 +10,8 @@ Fixes:
10 - detect when requesting to monitor a different file with the same name. 10 - detect when requesting to monitor a different file with the same name.
11 - memory leak when shutting down fallback monitor. 11 - memory leak when shutting down fallback monitor.
12 - properly shutdown monitor. 12 - properly shutdown monitor.
13 - Fix segfault when shutting down the Windows monitor.
13 14
14Improvements: 15Improvements:
15 16
16Removal: 17Removal:
17
diff --git a/legacy/eio/src/lib/eio_monitor_win32.c b/legacy/eio/src/lib/eio_monitor_win32.c
index 833d3d9533..33556b5947 100644
--- a/legacy/eio/src/lib/eio_monitor_win32.c
+++ b/legacy/eio/src/lib/eio_monitor_win32.c
@@ -53,6 +53,8 @@ struct _Eio_Monitor_Backend
53 Eio_Monitor_Win32_Watcher *dir; 53 Eio_Monitor_Win32_Watcher *dir;
54}; 54};
55 55
56static Eina_Bool _eio_monitor_win32_native = EINA_FALSE;
57
56static Eina_Bool 58static Eina_Bool
57_eio_monitor_win32_cb(void *data, Ecore_Win32_Handler *wh __UNUSED__) 59_eio_monitor_win32_cb(void *data, Ecore_Win32_Handler *wh __UNUSED__)
58{ 60{
@@ -149,7 +151,7 @@ _eio_monitor_win32_cb(void *data, Ecore_Win32_Handler *wh __UNUSED__)
149 FILE_NOTIFY_CHANGE_SECURITY; 151 FILE_NOTIFY_CHANGE_SECURITY;
150 152
151 ReadDirectoryChangesW(w->handle, 153 ReadDirectoryChangesW(w->handle,
152 w->buffer, 154 (LPVOID)w->buffer,
153 EIO_MONITOR_WIN32_BUFFER_SIZE, 155 EIO_MONITOR_WIN32_BUFFER_SIZE,
154 FALSE, 156 FALSE,
155 filter, 157 filter,
@@ -163,13 +165,15 @@ _eio_monitor_win32_cb(void *data, Ecore_Win32_Handler *wh __UNUSED__)
163static Eio_Monitor_Win32_Watcher * 165static Eio_Monitor_Win32_Watcher *
164_eio_monitor_win32_watcher_new(Eio_Monitor *monitor, unsigned char is_dir) 166_eio_monitor_win32_watcher_new(Eio_Monitor *monitor, unsigned char is_dir)
165{ 167{
168 char path[PATH_MAX];
166 Eio_Monitor_Win32_Watcher *w; 169 Eio_Monitor_Win32_Watcher *w;
167 DWORD filter; 170 DWORD filter;
168 171
169 w = (Eio_Monitor_Win32_Watcher *)calloc(1, sizeof(Eio_Monitor_Win32_Watcher)); 172 w = (Eio_Monitor_Win32_Watcher *)calloc(1, sizeof(Eio_Monitor_Win32_Watcher));
170 if (!w) return NULL; 173 if (!w) return NULL;
171 174
172 w->handle = CreateFile(monitor->path, 175 realpath(monitor->path, path);
176 w->handle = CreateFile(path,
173 FILE_LIST_DIRECTORY, 177 FILE_LIST_DIRECTORY,
174 FILE_SHARE_READ | 178 FILE_SHARE_READ |
175 FILE_SHARE_WRITE, 179 FILE_SHARE_WRITE,
@@ -198,14 +202,17 @@ _eio_monitor_win32_watcher_new(Eio_Monitor *monitor, unsigned char is_dir)
198 FILE_NOTIFY_CHANGE_SECURITY; 202 FILE_NOTIFY_CHANGE_SECURITY;
199 203
200 if (!ReadDirectoryChangesW(w->handle, 204 if (!ReadDirectoryChangesW(w->handle,
201 w->buffer, 205 (LPVOID)w->buffer,
202 EIO_MONITOR_WIN32_BUFFER_SIZE, 206 EIO_MONITOR_WIN32_BUFFER_SIZE,
203 FALSE, 207 FALSE,
204 filter, 208 filter,
205 &w->buf_length, 209 &w->buf_length,
206 &w->overlapped, 210 &w->overlapped,
207 NULL)) 211 NULL))
208 goto close_event; 212 {
213 printf("error : %s\n", evil_last_error_get());
214 goto close_event;
215 }
209 216
210 w->h = ecore_main_win32_handler_add(w->event, 217 w->h = ecore_main_win32_handler_add(w->event,
211 _eio_monitor_win32_cb, 218 _eio_monitor_win32_cb,
@@ -287,12 +294,13 @@ void eio_monitor_backend_add(Eio_Monitor *monitor)
287 return; 294 return;
288 } 295 }
289 296
297 _eio_monitor_win32_native = EINA_TRUE;
290 monitor->backend = backend; 298 monitor->backend = backend;
291} 299}
292 300
293void eio_monitor_backend_del(Eio_Monitor *monitor) 301void eio_monitor_backend_del(Eio_Monitor *monitor)
294{ 302{
295 if (!monitor->backend) 303 if (!_eio_monitor_win32_native)
296 { 304 {
297 eio_monitor_fallback_del(monitor); 305 eio_monitor_fallback_del(monitor);
298 return ; 306 return ;