summaryrefslogtreecommitdiff
path: root/src/lib/ecore
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2018-04-17 16:17:29 -0700
committerCedric BAIL <cedric@osg.samsung.com>2018-05-01 10:39:01 -0700
commit33fd77e9e43b0fa29cb484b72d910bdf0ecccbc8 (patch)
tree0ebd1c0615445af5e1321a85b6878087b4cb54a8 /src/lib/ecore
parent193149deb85004aeda452dd4d729f995f4f313f9 (diff)
ecore: move close_on_destructor to close_on_invalidate as that describe the behavior best.
Fix all use to correctly behave on invalidate.
Diffstat (limited to 'src/lib/ecore')
-rw-r--r--src/lib/ecore/efl_io_buffered_stream.c12
-rw-r--r--src/lib/ecore/efl_io_buffered_stream.eo2
-rw-r--r--src/lib/ecore/efl_io_closer_fd.c10
-rw-r--r--src/lib/ecore/efl_io_closer_fd.eo2
-rw-r--r--src/lib/ecore/efl_io_copier.c48
-rw-r--r--src/lib/ecore/efl_io_copier.eo11
-rw-r--r--src/lib/ecore/efl_io_file.c4
-rw-r--r--src/lib/ecore/efl_io_file.eo2
8 files changed, 49 insertions, 42 deletions
diff --git a/src/lib/ecore/efl_io_buffered_stream.c b/src/lib/ecore/efl_io_buffered_stream.c
index 3f34aca9fc..3a0921f959 100644
--- a/src/lib/ecore/efl_io_buffered_stream.c
+++ b/src/lib/ecore/efl_io_buffered_stream.c
@@ -227,15 +227,15 @@ _efl_io_buffered_stream_efl_io_closer_close_on_exec_set(Eo *o EINA_UNUSED, Efl_I
227} 227}
228 228
229EOLIAN static Eina_Bool 229EOLIAN static Eina_Bool
230_efl_io_buffered_stream_efl_io_closer_close_on_destructor_get(const Eo *o EINA_UNUSED, Efl_Io_Buffered_Stream_Data *pd) 230_efl_io_buffered_stream_efl_io_closer_close_on_invalidate_get(const Eo *o EINA_UNUSED, Efl_Io_Buffered_Stream_Data *pd)
231{ 231{
232 return efl_io_closer_close_on_destructor_get(pd->inner_io); 232 return efl_io_closer_close_on_invalidate_get(pd->inner_io);
233} 233}
234 234
235EOLIAN static void 235EOLIAN static void
236_efl_io_buffered_stream_efl_io_closer_close_on_destructor_set(Eo *o EINA_UNUSED, Efl_Io_Buffered_Stream_Data *pd, Eina_Bool value) 236_efl_io_buffered_stream_efl_io_closer_close_on_invalidate_set(Eo *o EINA_UNUSED, Efl_Io_Buffered_Stream_Data *pd, Eina_Bool value)
237{ 237{
238 efl_io_closer_close_on_destructor_set(pd->inner_io, value); 238 efl_io_closer_close_on_invalidate_set(pd->inner_io, value);
239} 239}
240 240
241EOLIAN static Eina_Error 241EOLIAN static Eina_Error
@@ -369,7 +369,7 @@ _efl_io_buffered_stream_inner_io_set(Eo *o, Efl_Io_Buffered_Stream_Data *pd, Efl
369 efl_io_copier_buffer_limit_set(efl_added, 4096), 369 efl_io_copier_buffer_limit_set(efl_added, 4096),
370 efl_io_copier_source_set(efl_added, io), 370 efl_io_copier_source_set(efl_added, io),
371 efl_io_copier_destination_set(efl_added, pd->incoming), 371 efl_io_copier_destination_set(efl_added, pd->incoming),
372 efl_io_closer_close_on_destructor_set(efl_added, efl_io_closer_close_on_destructor_get(io)), 372 efl_io_closer_close_on_invalidate_set(efl_added, efl_io_closer_close_on_invalidate_get(io)),
373 efl_event_callback_array_add(efl_added, _efl_io_buffered_stream_receiver_cbs(), o)); 373 efl_event_callback_array_add(efl_added, _efl_io_buffered_stream_receiver_cbs(), o));
374 EINA_SAFETY_ON_NULL_RETURN(pd->receiver); 374 EINA_SAFETY_ON_NULL_RETURN(pd->receiver);
375 } 375 }
@@ -394,7 +394,7 @@ _efl_io_buffered_stream_inner_io_set(Eo *o, Efl_Io_Buffered_Stream_Data *pd, Efl
394 efl_io_copier_buffer_limit_set(efl_added, 4096), 394 efl_io_copier_buffer_limit_set(efl_added, 4096),
395 efl_io_copier_source_set(efl_added, pd->outgoing), 395 efl_io_copier_source_set(efl_added, pd->outgoing),
396 efl_io_copier_destination_set(efl_added, io), 396 efl_io_copier_destination_set(efl_added, io),
397 efl_io_closer_close_on_destructor_set(efl_added, efl_io_closer_close_on_destructor_get(io)), 397 efl_io_closer_close_on_invalidate_set(efl_added, efl_io_closer_close_on_invalidate_get(io)),
398 efl_event_callback_array_add(efl_added, _efl_io_buffered_stream_sender_cbs(), o)); 398 efl_event_callback_array_add(efl_added, _efl_io_buffered_stream_sender_cbs(), o));
399 EINA_SAFETY_ON_NULL_RETURN(pd->sender); 399 EINA_SAFETY_ON_NULL_RETURN(pd->sender);
400 } 400 }
diff --git a/src/lib/ecore/efl_io_buffered_stream.eo b/src/lib/ecore/efl_io_buffered_stream.eo
index 5c413aea91..973de1849e 100644
--- a/src/lib/ecore/efl_io_buffered_stream.eo
+++ b/src/lib/ecore/efl_io_buffered_stream.eo
@@ -251,7 +251,7 @@ class Efl.Io.Buffered_Stream (Efl.Loop_Consumer, Efl.Io.Reader, Efl.Io.Writer, E
251 Efl.Io.Closer.close; 251 Efl.Io.Closer.close;
252 Efl.Io.Closer.closed { get; } 252 Efl.Io.Closer.closed { get; }
253 Efl.Io.Closer.close_on_exec { get; set; } 253 Efl.Io.Closer.close_on_exec { get; set; }
254 Efl.Io.Closer.close_on_destructor { get; set; } 254 Efl.Io.Closer.close_on_invalidate { get; set; }
255 Efl.Io.Reader.read; 255 Efl.Io.Reader.read;
256 Efl.Io.Reader.can_read { get; set; } 256 Efl.Io.Reader.can_read { get; set; }
257 Efl.Io.Reader.eos { get; set; } 257 Efl.Io.Reader.eos { get; set; }
diff --git a/src/lib/ecore/efl_io_closer_fd.c b/src/lib/ecore/efl_io_closer_fd.c
index 9dcea594bc..d0ace13bfe 100644
--- a/src/lib/ecore/efl_io_closer_fd.c
+++ b/src/lib/ecore/efl_io_closer_fd.c
@@ -15,7 +15,7 @@ typedef struct _Efl_Io_Closer_Fd_Data
15 int fd; 15 int fd;
16 16
17 Eina_Bool close_on_exec; 17 Eina_Bool close_on_exec;
18 Eina_Bool close_on_destructor; 18 Eina_Bool close_on_invalidate;
19} Efl_Io_Closer_Fd_Data; 19} Efl_Io_Closer_Fd_Data;
20 20
21static Efl_Object * 21static Efl_Object *
@@ -119,15 +119,15 @@ _efl_io_closer_fd_efl_io_closer_close_on_exec_get(const Eo *o, Efl_Io_Closer_Fd_
119} 119}
120 120
121EOLIAN static void 121EOLIAN static void
122_efl_io_closer_fd_efl_io_closer_close_on_destructor_set(Eo *o EINA_UNUSED, Efl_Io_Closer_Fd_Data *pd, Eina_Bool close_on_destructor) 122_efl_io_closer_fd_efl_io_closer_close_on_invalidate_set(Eo *o EINA_UNUSED, Efl_Io_Closer_Fd_Data *pd, Eina_Bool close_on_invalidate)
123{ 123{
124 pd->close_on_destructor = close_on_destructor; 124 pd->close_on_invalidate = close_on_invalidate;
125} 125}
126 126
127EOLIAN static Eina_Bool 127EOLIAN static Eina_Bool
128_efl_io_closer_fd_efl_io_closer_close_on_destructor_get(const Eo *o EINA_UNUSED, Efl_Io_Closer_Fd_Data *pd) 128_efl_io_closer_fd_efl_io_closer_close_on_invalidate_get(const Eo *o EINA_UNUSED, Efl_Io_Closer_Fd_Data *pd)
129{ 129{
130 return pd->close_on_destructor; 130 return pd->close_on_invalidate;
131} 131}
132 132
133#include "efl_io_closer_fd.eo.c" 133#include "efl_io_closer_fd.eo.c"
diff --git a/src/lib/ecore/efl_io_closer_fd.eo b/src/lib/ecore/efl_io_closer_fd.eo
index b0b63b364b..721e449f1d 100644
--- a/src/lib/ecore/efl_io_closer_fd.eo
+++ b/src/lib/ecore/efl_io_closer_fd.eo
@@ -20,6 +20,6 @@ mixin Efl.Io.Closer_Fd (Efl.Io.Closer, Efl.Object) {
20 Efl.Io.Closer.close; 20 Efl.Io.Closer.close;
21 Efl.Io.Closer.closed { get; } 21 Efl.Io.Closer.closed { get; }
22 Efl.Io.Closer.close_on_exec { get; set; } 22 Efl.Io.Closer.close_on_exec { get; set; }
23 Efl.Io.Closer.close_on_destructor { get; set; } 23 Efl.Io.Closer.close_on_invalidate { get; set; }
24 } 24 }
25} 25}
diff --git a/src/lib/ecore/efl_io_copier.c b/src/lib/ecore/efl_io_copier.c
index 9298459d89..686454912d 100644
--- a/src/lib/ecore/efl_io_copier.c
+++ b/src/lib/ecore/efl_io_copier.c
@@ -28,7 +28,7 @@ typedef struct _Efl_Io_Copier_Data
28 Eina_Bool done; 28 Eina_Bool done;
29 Eina_Bool force_dispatch; 29 Eina_Bool force_dispatch;
30 Eina_Bool close_on_exec; 30 Eina_Bool close_on_exec;
31 Eina_Bool close_on_destructor; 31 Eina_Bool close_on_invalidate;
32} Efl_Io_Copier_Data; 32} Efl_Io_Copier_Data;
33 33
34static void _efl_io_copier_write(Eo *o, Efl_Io_Copier_Data *pd); 34static void _efl_io_copier_write(Eo *o, Efl_Io_Copier_Data *pd);
@@ -433,7 +433,7 @@ _efl_io_copier_source_set(Eo *o, Efl_Io_Copier_Data *pd, Efl_Io_Reader *source)
433 if (efl_isa(pd->source, EFL_IO_CLOSER_MIXIN)) 433 if (efl_isa(pd->source, EFL_IO_CLOSER_MIXIN))
434 { 434 {
435 efl_io_closer_close_on_exec_set(pd->source, efl_io_closer_close_on_exec_get(o)); 435 efl_io_closer_close_on_exec_set(pd->source, efl_io_closer_close_on_exec_get(o));
436 efl_io_closer_close_on_destructor_set(pd->source, efl_io_closer_close_on_destructor_get(o)); 436 efl_io_closer_close_on_invalidate_set(pd->source, efl_io_closer_close_on_invalidate_get(o));
437 efl_event_callback_add(pd->source, EFL_IO_CLOSER_EVENT_CLOSED, 437 efl_event_callback_add(pd->source, EFL_IO_CLOSER_EVENT_CLOSED,
438 _efl_io_copier_source_closed, o); 438 _efl_io_copier_source_closed, o);
439 } 439 }
@@ -512,7 +512,7 @@ _efl_io_copier_destination_set(Eo *o, Efl_Io_Copier_Data *pd, Efl_Io_Writer *des
512 if (efl_isa(pd->destination, EFL_IO_CLOSER_MIXIN)) 512 if (efl_isa(pd->destination, EFL_IO_CLOSER_MIXIN))
513 { 513 {
514 efl_io_closer_close_on_exec_set(pd->destination, efl_io_closer_close_on_exec_get(o)); 514 efl_io_closer_close_on_exec_set(pd->destination, efl_io_closer_close_on_exec_get(o));
515 efl_io_closer_close_on_destructor_set(pd->destination, efl_io_closer_close_on_destructor_get(o)); 515 efl_io_closer_close_on_invalidate_set(pd->destination, efl_io_closer_close_on_invalidate_get(o));
516 efl_event_callback_add(pd->destination, EFL_IO_CLOSER_EVENT_CLOSED, 516 efl_event_callback_add(pd->destination, EFL_IO_CLOSER_EVENT_CLOSED,
517 _efl_io_copier_destination_closed, o); 517 _efl_io_copier_destination_closed, o);
518 } 518 }
@@ -806,7 +806,7 @@ _efl_io_copier_efl_object_constructor(Eo *o, Efl_Io_Copier_Data *pd)
806{ 806{
807 pd->buf = eina_binbuf_new(); 807 pd->buf = eina_binbuf_new();
808 pd->close_on_exec = EINA_TRUE; 808 pd->close_on_exec = EINA_TRUE;
809 pd->close_on_destructor = EINA_TRUE; 809 pd->close_on_invalidate = EINA_TRUE;
810 pd->timeout_inactivity = 0.0; 810 pd->timeout_inactivity = 0.0;
811 811
812 EINA_SAFETY_ON_NULL_RETURN_VAL(pd->buf, NULL); 812 EINA_SAFETY_ON_NULL_RETURN_VAL(pd->buf, NULL);
@@ -836,17 +836,9 @@ _efl_io_copier_efl_object_finalize(Eo *o, Efl_Io_Copier_Data *pd)
836} 836}
837 837
838EOLIAN static void 838EOLIAN static void
839_efl_io_copier_efl_object_destructor(Eo *o, Efl_Io_Copier_Data *pd) 839_efl_io_copier_efl_object_invalidate(Eo *o, Efl_Io_Copier_Data *pd EINA_UNUSED)
840{ 840{
841 _COPIER_DBG(o, pd); 841 if (efl_io_closer_close_on_invalidate_get(o) &&
842
843 if (pd->job)
844 eina_future_cancel(pd->job);
845
846 if (pd->inactivity_timer)
847 eina_future_cancel(pd->inactivity_timer);
848
849 if (efl_io_closer_close_on_destructor_get(o) &&
850 (!efl_io_closer_closed_get(o))) 842 (!efl_io_closer_closed_get(o)))
851 { 843 {
852 efl_event_freeze(o); 844 efl_event_freeze(o);
@@ -857,6 +849,20 @@ _efl_io_copier_efl_object_destructor(Eo *o, Efl_Io_Copier_Data *pd)
857 efl_io_copier_source_set(o, NULL); 849 efl_io_copier_source_set(o, NULL);
858 efl_io_copier_destination_set(o, NULL); 850 efl_io_copier_destination_set(o, NULL);
859 851
852 efl_invalidate(efl_super(o, MY_CLASS));
853}
854
855EOLIAN static void
856_efl_io_copier_efl_object_destructor(Eo *o, Efl_Io_Copier_Data *pd)
857{
858 _COPIER_DBG(o, pd);
859
860 if (pd->job)
861 eina_future_cancel(pd->job);
862
863 if (pd->inactivity_timer)
864 eina_future_cancel(pd->inactivity_timer);
865
860 efl_destructor(efl_super(o, MY_CLASS)); 866 efl_destructor(efl_super(o, MY_CLASS));
861 867
862 if (pd->buf) 868 if (pd->buf)
@@ -895,22 +901,22 @@ _efl_io_copier_efl_io_closer_close_on_exec_get(const Eo *o EINA_UNUSED, Efl_Io_C
895} 901}
896 902
897EOLIAN static void 903EOLIAN static void
898_efl_io_copier_efl_io_closer_close_on_destructor_set(Eo *o EINA_UNUSED, Efl_Io_Copier_Data *pd, Eina_Bool close_on_destructor) 904_efl_io_copier_efl_io_closer_close_on_invalidate_set(Eo *o EINA_UNUSED, Efl_Io_Copier_Data *pd, Eina_Bool close_on_invalidate)
899{ 905{
900 if (pd->close_on_destructor == close_on_destructor) return; 906 if (pd->close_on_invalidate == close_on_invalidate) return;
901 pd->close_on_destructor = close_on_destructor; 907 pd->close_on_invalidate = close_on_invalidate;
902 908
903 if (pd->source && efl_isa(pd->source, EFL_IO_CLOSER_MIXIN)) 909 if (pd->source && efl_isa(pd->source, EFL_IO_CLOSER_MIXIN))
904 efl_io_closer_close_on_destructor_set(pd->source, close_on_destructor); 910 efl_io_closer_close_on_invalidate_set(pd->source, close_on_invalidate);
905 911
906 if (pd->destination && efl_isa(pd->destination, EFL_IO_CLOSER_MIXIN)) 912 if (pd->destination && efl_isa(pd->destination, EFL_IO_CLOSER_MIXIN))
907 efl_io_closer_close_on_destructor_set(pd->destination, close_on_destructor); 913 efl_io_closer_close_on_invalidate_set(pd->destination, close_on_invalidate);
908} 914}
909 915
910EOLIAN static Eina_Bool 916EOLIAN static Eina_Bool
911_efl_io_copier_efl_io_closer_close_on_destructor_get(const Eo *o EINA_UNUSED, Efl_Io_Copier_Data *pd) 917_efl_io_copier_efl_io_closer_close_on_invalidate_get(const Eo *o EINA_UNUSED, Efl_Io_Copier_Data *pd)
912{ 918{
913 return pd->close_on_destructor; 919 return pd->close_on_invalidate;
914} 920}
915 921
916#include "efl_io_copier.eo.c" 922#include "efl_io_copier.eo.c"
diff --git a/src/lib/ecore/efl_io_copier.eo b/src/lib/ecore/efl_io_copier.eo
index 345775eb77..ae40851681 100644
--- a/src/lib/ecore/efl_io_copier.eo
+++ b/src/lib/ecore/efl_io_copier.eo
@@ -57,7 +57,7 @@ class Efl.Io.Copier (Efl.Loop_Consumer, Efl.Io.Closer) {
57 @.source and @.destination if they implement those interfaces. 57 @.source and @.destination if they implement those interfaces.
58 58
59 @Efl.Io.Closer.close_on_exec and 59 @Efl.Io.Closer.close_on_exec and
60 @Efl.Io.Closer.close_on_destructor are respected and applied to 60 @Efl.Io.Closer.close_on_invalidate are respected and applied to
61 both source and destination. Both default to $true. 61 both source and destination. Both default to $true.
62 62
63 @since 1.19 63 @since 1.19
@@ -107,7 +107,7 @@ class Efl.Io.Copier (Efl.Loop_Consumer, Efl.Io.Closer) {
107 If the source object implements @Efl.Io.Closer and it's 107 If the source object implements @Efl.Io.Closer and it's
108 not closed, it will be closed when the copier itself 108 not closed, it will be closed when the copier itself
109 is. This may happen, for example, when the copier is 109 is. This may happen, for example, when the copier is
110 deleted and @Efl.Io.Closer.close_on_destructor is $true 110 deleted and @Efl.Io.Closer.close_on_invalidate is $true
111 (the default). 111 (the default).
112 112
113 Common source classes are @Efl.Io.Buffer (if fixed data 113 Common source classes are @Efl.Io.Buffer (if fixed data
@@ -166,7 +166,7 @@ class Efl.Io.Copier (Efl.Loop_Consumer, Efl.Io.Closer) {
166 If the destination object implements @Efl.Io.Closer and it's 166 If the destination object implements @Efl.Io.Closer and it's
167 not closed, it will be closed when the copier itself 167 not closed, it will be closed when the copier itself
168 is. This may happen, for example, when the copier is 168 is. This may happen, for example, when the copier is
169 deleted and @Efl.Io.Closer.close_on_destructor is $true 169 deleted and @Efl.Io.Closer.close_on_invalidate is $true
170 (the default). 170 (the default).
171 171
172 Common destination classes are @Efl.Io.Buffer (better to 172 Common destination classes are @Efl.Io.Buffer (better to
@@ -370,11 +370,12 @@ class Efl.Io.Copier (Efl.Loop_Consumer, Efl.Io.Closer) {
370 370
371 implements { 371 implements {
372 Efl.Object.constructor; 372 Efl.Object.constructor;
373 Efl.Object.destructor;
374 Efl.Object.finalize; 373 Efl.Object.finalize;
374 Efl.Object.invalidate;
375 Efl.Object.destructor;
375 Efl.Io.Closer.close; 376 Efl.Io.Closer.close;
376 Efl.Io.Closer.closed { get; } 377 Efl.Io.Closer.closed { get; }
377 Efl.Io.Closer.close_on_exec { get; set; } 378 Efl.Io.Closer.close_on_exec { get; set; }
378 Efl.Io.Closer.close_on_destructor { get; set; } 379 Efl.Io.Closer.close_on_invalidate { get; set; }
379 } 380 }
380} 381}
diff --git a/src/lib/ecore/efl_io_file.c b/src/lib/ecore/efl_io_file.c
index cfee3371fc..c8716d2935 100644
--- a/src/lib/ecore/efl_io_file.c
+++ b/src/lib/ecore/efl_io_file.c
@@ -112,7 +112,7 @@ _efl_io_file_efl_object_constructor(Eo *o, Efl_Io_File_Data *pd)
112 o = efl_constructor(efl_super(o, MY_CLASS)); 112 o = efl_constructor(efl_super(o, MY_CLASS));
113 113
114 efl_io_closer_close_on_exec_set(o, EINA_TRUE); 114 efl_io_closer_close_on_exec_set(o, EINA_TRUE);
115 efl_io_closer_close_on_destructor_set(o, EINA_TRUE); 115 efl_io_closer_close_on_invalidate_set(o, EINA_TRUE);
116 efl_io_positioner_fd_set(o, -1); 116 efl_io_positioner_fd_set(o, -1);
117 efl_io_sizer_fd_set(o, -1); 117 efl_io_sizer_fd_set(o, -1);
118 efl_io_reader_fd_set(o, -1); 118 efl_io_reader_fd_set(o, -1);
@@ -125,7 +125,7 @@ _efl_io_file_efl_object_constructor(Eo *o, Efl_Io_File_Data *pd)
125EOLIAN static void 125EOLIAN static void
126_efl_io_file_efl_object_destructor(Eo *o, Efl_Io_File_Data *pd) 126_efl_io_file_efl_object_destructor(Eo *o, Efl_Io_File_Data *pd)
127{ 127{
128 if (efl_io_closer_close_on_destructor_get(o) && 128 if (efl_io_closer_close_on_invalidate_get(o) &&
129 (!efl_io_closer_closed_get(o))) 129 (!efl_io_closer_closed_get(o)))
130 { 130 {
131 efl_event_freeze(o); 131 efl_event_freeze(o);
diff --git a/src/lib/ecore/efl_io_file.eo b/src/lib/ecore/efl_io_file.eo
index 4040f5dc86..b586a88ca2 100644
--- a/src/lib/ecore/efl_io_file.eo
+++ b/src/lib/ecore/efl_io_file.eo
@@ -2,7 +2,7 @@ class Efl.Io.File (Efl.Loop_Fd, Efl.File, Efl.Io.Reader_Fd, Efl.Io.Writer_Fd, Ef
2 [[File access (open, close, read, write, lseek, ftruncate) 2 [[File access (open, close, read, write, lseek, ftruncate)
3 3
4 @Efl.Io.Closer.close_on_exec and 4 @Efl.Io.Closer.close_on_exec and
5 @Efl.Io.Closer.close_on_destructor are respected and default to 5 @Efl.Io.Closer.close_on_invalidate are respected and default to
6 $true. @Efl.Io.Closer.close_on_exec.set sets flag O_CLOEXEC. 6 $true. @Efl.Io.Closer.close_on_exec.set sets flag O_CLOEXEC.
7 7
8 @since 1.19 8 @since 1.19