summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2020-04-14 03:26:05 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-04-14 11:56:29 +0200
commit020cea923e4dfa2103fc3c935d736a464f73d646 (patch)
tree31c4cb19a755b7f77d458031d8f39e5d68651086
parent96288c7683e7f252e9bcb113818b8cda8a23c31a (diff)
ecore_evas_x: add safety check for data in converterdevs/bu5hm4n/work_dnd
since the existance of seleciton manager, the converter callbacks from ecore_x are expecting custom struct pointers. However, enlightenment never updated to use the elm dnd API for client side usages. Which results in the fact that sometimes, when a client sents Notify, and e_dnd is active, that this converter is executed with the wrong data. With this commit the data passed in is ensured to have the correct magic number. The proper solution for this would either be registering the correct converters in enlightenment, or update to elm_drag. However, since the continues cried river over the last 5 days has raised enough hydro power to add these changes. This leaves us with just one question: How was it possible to generate so many messages about a problem that can be solved in a fraction of charaters that have been written? fixes <a-issue-that-was-never-created> Differential Revision: https://phab.enlightenment.org/D11701
-rw-r--r--src/modules/ecore_evas/engines/x/ecore_evas_x.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/modules/ecore_evas/engines/x/ecore_evas_x.c b/src/modules/ecore_evas/engines/x/ecore_evas_x.c
index a107f66a6d..1a0ae1f4b8 100644
--- a/src/modules/ecore_evas/engines/x/ecore_evas_x.c
+++ b/src/modules/ecore_evas/engines/x/ecore_evas_x.c
@@ -49,6 +49,8 @@
49# endif 49# endif
50#endif /* ! _WIN32 */ 50#endif /* ! _WIN32 */
51 51
52#define ECORE_EVAS_X11_SELECTION 0x7F
53
52#define EDBG(...) \ 54#define EDBG(...) \
53 EINA_LOG(_ecore_evas_log_dom, EINA_LOG_LEVEL_DBG + 1, __VA_ARGS__); 55 EINA_LOG(_ecore_evas_log_dom, EINA_LOG_LEVEL_DBG + 1, __VA_ARGS__);
54 56
@@ -75,6 +77,7 @@ static Eina_Bool wm_exists;
75typedef struct _Ecore_Evas_Engine_Data_X11 Ecore_Evas_Engine_Data_X11; 77typedef struct _Ecore_Evas_Engine_Data_X11 Ecore_Evas_Engine_Data_X11;
76 78
77typedef struct { 79typedef struct {
80 EINA_MAGIC;
78 Ecore_Evas_Selection_Callbacks callbacks; 81 Ecore_Evas_Selection_Callbacks callbacks;
79 Ecore_Evas_Selection_Buffer buffer; 82 Ecore_Evas_Selection_Buffer buffer;
80 Ecore_Evas *ee; 83 Ecore_Evas *ee;
@@ -4053,6 +4056,11 @@ _eina_content_converter(char *target, void *data, int size EINA_UNUSED, void **d
4053{ 4056{
4054 Ecore_Evas_X11_Selection_Data *sdata = data; 4057 Ecore_Evas_X11_Selection_Data *sdata = data;
4055 Eina_Bool ret = EINA_FALSE;; 4058 Eina_Bool ret = EINA_FALSE;;
4059
4060 if (size != sizeof(Ecore_Evas_X11_Selection_Data)) return EINA_FALSE;
4061
4062 if (!EINA_MAGIC_CHECK(sdata, ECORE_EVAS_X11_SELECTION)) return EINA_FALSE;
4063
4056 if (eina_streq(target, "TARGETS") || eina_streq(target, "ATOM")) 4064 if (eina_streq(target, "TARGETS") || eina_streq(target, "ATOM"))
4057 { 4065 {
4058 //list all available types that we have currently 4066 //list all available types that we have currently
@@ -4327,6 +4335,7 @@ _ecore_evas_x_selection_window_init(Ecore_Evas *ee)
4327 ecore_x_fixes_window_selection_notification_request(ee->prop.window, ecore_evas_selection_to_atom[i]); 4335 ecore_x_fixes_window_selection_notification_request(ee->prop.window, ecore_evas_selection_to_atom[i]);
4328 edata->selection_data[i].ee = ee; 4336 edata->selection_data[i].ee = ee;
4329 edata->selection_data[i].buffer = i; 4337 edata->selection_data[i].buffer = i;
4338 EINA_MAGIC_SET(&edata->selection_data[i], ECORE_EVAS_X11_SELECTION);
4330 } 4339 }
4331 ecore_x_dnd_aware_set(ee->prop.window, EINA_TRUE); 4340 ecore_x_dnd_aware_set(ee->prop.window, EINA_TRUE);
4332 edata->init_job = ecore_job_add(_deliver_selection_changed, ee); 4341 edata->init_job = ecore_job_add(_deliver_selection_changed, ee);