* Memory allocated by atspi event must be manually freed.
* g_object_unref objects returned by _directional_depth_first_search.
* Remove memory leak in navigator.c
* Remove component leaks.
* Remove memory leak in _focus_widget
* Fix memory leak and memory corruption in app_tracker.c.
* Remove memory leak from screen reader spi module.
* AtspiDevice events must be free with g_boxed_free.
* Free atspi relation set.
* Free memory allocated by atspi_accessible_get_component_iface.
* Remove leak in flat_navic.
* Remove memory leaks from smart notification module.
* Remove memory leaks from spi module.
Change-Id: I76e3c18f2b6bb1d1d6008c68a8b32587779a8f50
* @param ctx FlatNaviContext
* @param x_cord gint X coordinate
* @param y_cord gint Y coordinate
- * @param obj AtspiAccessible Reference to object on point
+ * @param obj AtspiAccessible Reference to object on point.
+ * Caller is responsible for free this object with g_object_unref.
*
* @return Eina_Bool true on success
*
*
* @param ctx FlatNaviContext
*
- * @return Ownership of the first object in context
+ * @return Ownership of the first object in context.
+ * Caller is responsible for free this object with g_object_unref.
*
* @see flat_navi_context_first()
* @see flat_navi_context_free()
*/
-const AtspiAccessible *flat_navi_context_first_get(FlatNaviContext *ctx);
+AtspiAccessible *flat_navi_context_first_get(FlatNaviContext *ctx);
/**
* @brief Returns the last item in context;
*
* @param ctx FlatNaviContext
*
- * @return Ownership of the last object in context
+ * @return Ownership of the last object in context.
+ * Caller is responsible for free this object with g_object_unref.
*
* @see flat_navi_context_last()
* @see flat_navi_context_free()
*/
-const AtspiAccessible *flat_navi_context_last_get(FlatNaviContext *ctx);
+AtspiAccessible *flat_navi_context_last_get(FlatNaviContext *ctx);
typedef enum {
FLAT_NAVI_CONTEXT_VALID, // context is valid
}
if (atd->view_content_changed_ecd && atd->view_content_changed_ecd->func) {
- AtspiRole role = ATSPI_ROLE_INVALID;
- AtspiAccessibleDefaultLabelInfo *dli;
-
Eina_Bool default_label_enabled = EINA_TRUE;
- AtspiAccessible *root = atd->root;
- GHashTable *attributes = NULL;
gchar *attribute_default_label = NULL;
+ AtspiAccessibleDefaultLabelInfo *dli =
+ atspi_accessible_get_default_label_info(atd->root, NULL);
- dli = atspi_accessible_get_default_label_info(atd->root, NULL);
if (!dli) {
ERROR("Default label info is NULL!");
return FALSE;
}
- WindowActivateInfoType window_activate_info_type = window_tracker_window_activate_info_type_get(atd->window_tracker_data, root);
-
- root = dli->obj;
- role = dli->role;
- attributes = dli->attributes;
+ WindowActivateInfoType window_activate_info_type =
+ window_tracker_window_activate_info_type_get(atd->window_tracker_data, atd->root);
if (window_activate_info_type & ACCESSIBLE_WINDOW_ACTIVATE_INFO_DEFAULT_LABEL_ENABLED_WITHOUT_WINDOW) {
- switch (role) {
+ switch (dli->role) {
case ATSPI_ROLE_PAGE_TAB:
case ATSPI_ROLE_POPUP_MENU:
case ATSPI_ROLE_PANEL:
default_label_enabled = EINA_FALSE;
}
- if (attributes && (role != ATSPI_ROLE_WINDOW && role != ATSPI_ROLE_INPUT_METHOD_WINDOW)) {
- attribute_default_label = g_hash_table_lookup(attributes, "default_label");
+ if (dli->attributes && (dli->role != ATSPI_ROLE_WINDOW && dli->role != ATSPI_ROLE_INPUT_METHOD_WINDOW)) {
+ attribute_default_label = g_hash_table_lookup(dli->attributes, "default_label");
if (attribute_default_label) {
if (!g_strcmp0(attribute_default_label, "disabled")) {
default_label_enabled = EINA_FALSE;
if (default_label_enabled)
tw_purge(EINA_TRUE);
- gchar *id = atspi_accessible_get_unique_id(root, NULL);
- DEBUG("Rebuilding navigation context - root: %s, role: %d, default_label_enabled : %s", id, role, default_label_enabled ? "true" : "false");
+ gchar *id = atspi_accessible_get_unique_id(dli->obj, NULL);
+ DEBUG("Rebuilding navigation context - root: %s, role: %d, default_label_enabled : %s", id, dli->role, default_label_enabled ? "true" : "false");
g_free(id);
- if (root)
- atd->view_content_changed_ecd->func(root, role, atd->view_content_changed_ecd->user_data, default_label_enabled);
+ if (dli->obj)
+ atd->view_content_changed_ecd->func(dli->obj, dli->role, atd->view_content_changed_ecd->user_data, default_label_enabled);
+
if (dli->attributes)
g_hash_table_unref(dli->attributes);
+ if (dli->obj)
+ g_object_unref(dli->obj);
g_free(dli);
}
atd->timer = 0;
{
DEBUG("START");
App_Tracker_Data *atd = (App_Tracker_Data*)data;
- AtspiAccessible *current_obj = atd->read_timer_user_data;
+ AtspiAccessible *current_obj = g_object_ref(atd->read_timer_user_data);
+
generate_what_to_read_and_speak(get_pointer_to_service_data_struct()->navigator_data, current_obj, EINA_TRUE);
atd->read_timer = NULL;
+
+ g_object_unref(atd->read_timer_user_data);
atd->read_timer_user_data = NULL; /* It's on to clean it as we cancel next call. */
+
sound_n_vibration_feedback_generate(current_obj);
+ g_object_unref(current_obj);
+
return ECORE_CALLBACK_CANCEL;
}
#endif
if (obj) {
comp = atspi_accessible_get_component_iface(obj);
rect = atspi_component_get_extents(comp, ATSPI_COORD_TYPE_SCREEN, NULL);
+ g_object_unref(comp);
highlighted_object_x = rect->x + rect->width / 2;
highlighted_object_y = rect->y + rect->height / 2;
g_free(rect);
if (!event->source) {
ERROR("empty event source");
- return;
+ goto end;
}
if (!user_data) {
ERROR("user_data could not be NULL");
- return;
+ goto end;
}
App_Tracker_Data *atd = (App_Tracker_Data*)user_data;
AtspiRole role = atspi_accessible_get_role(event->source, NULL);
if (role == ATSPI_ROLE_DESKTOP_FRAME)
- return;
+ goto end;
gchar *id = atspi_accessible_get_unique_id(event->source, NULL);
DEBUG("signal:%s, source: %s, role: %d, detail1:%i, detail2: %i", event->type, id, role, event->detail1, event->detail2);
if (!g_strcmp0(event->type, "object:state-changed:highlighted")) {
#ifndef SCREEN_READER_TV
if (event->detail1) {//Update highlight object only when grab is called
- new_highlighted_obj = event->source;
- if (atd->read_timer) {
+ new_highlighted_obj = g_object_ref(event->source); /* new ref */
+
+ if (atd->read_timer)
ecore_timer_del(atd->read_timer);
- atd->read_timer_user_data = NULL;
- }
+ g_object_unref(atd->read_timer_user_data);
atd->read_timer_user_data = new_highlighted_obj;
+ g_object_ref(atd->read_timer_user_data);
+
atd->read_timer = ecore_timer_add(HIGHLIGHT_UPDATE_READ_TIMEOUT, _read_cb, atd);
atd->prev_highlighted_obj = new_highlighted_obj;
/* send - scroll gesture required info */
g_free(id);
ecore_timer_del(atd->read_timer);
atd->read_timer = NULL;
+
+ g_object_unref(atd->read_timer_user_data);
atd->read_timer_user_data = NULL;
}
}
#endif
} else if (!g_strcmp0(event->type, "object:active-descendant-changed")) {
- new_highlighted_obj = atspi_accessible_get_child_at_index(event->source, event->detail1, NULL);
+ new_highlighted_obj = atspi_accessible_get_child_at_index(event->source, event->detail1, NULL); /* new ref */
} else if (!g_strcmp0("object:state-changed:showing", event->type)) {
if (event->detail1) { /* Showing */
if (role == ATSPI_ROLE_WINDOW) {
if (is_text_selection_mode) {
/*TODO: this ignores toast popup providing cut, copy information.
if other popup is showing then rebuild navigation context. */
- return;
+ goto end;
}
if (window_tracker_subroot_get(atd->window_tracker_data)) {
char *text_to_speak = NULL;
timer_reschedule(atd);
}
}
- }
- else if (!g_strcmp0(event->type, "object:bounds-changed")) {
+ } else if (!g_strcmp0(event->type, "object:bounds-changed")) {
AtspiRect *rect;
rect = (AtspiRect *)g_value_get_boxed(&event->any_data);
DEBUG("Window geometry: %d %d", rect->width, rect->height);
}
}
- }
- else if (!g_strcmp0(event->type, "object:property-change:accessible-name") && object_has_highlighted_state(event->source)
+ } else if (!g_strcmp0(event->type, "object:property-change:accessible-name") && object_has_highlighted_state(event->source)
&& (get_objects_attributes(event->source) & ACCESSIBLE_READING_INFO_TYPE_NAME)) {
gchar *name = atspi_accessible_get_name(event->source, NULL);
if (!name) {
ERROR("name is null");
- return;
+ goto end;
}
DEBUG("New name for object, read:%s", name);
tw_speak_customized(name, EINA_TRUE, EINA_TRUE, event->source, 0);
g_free(name);
- return;
- }
- // for reading slider and spinner value changes
- else if (!g_strcmp0(event->type, "object:property-change:accessible-value")) {
+ goto end;
+ } else if (!g_strcmp0(event->type, "object:property-change:accessible-value")) { // for reading slider and spinner value changes
if (role == ATSPI_ROLE_SLIDER && (get_objects_attributes(event->source) & ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION)) {
AtspiValue *value_interface = atspi_accessible_get_value_iface(event->source);
_read_value(value_interface);
gchar *name = atspi_accessible_get_name(event->source, NULL);
if (!name) {
ERROR("name is null");
- return;
+ goto end;
}
tw_speak_customized(name, EINA_TRUE, EINA_TRUE, event->source, 0);
g_free(name);
SUPPRESS_FORMAT_ERROR(g_snprintf(buf, sizeof(buf), _("IDS_COM_POP_ITEM_DROPPED_INTO_POSITION_PD_TTS"), idx + 1));
tw_speak_customized(buf, EINA_TRUE, EINA_TRUE, event->source, 0);
g_error_free(err);
- }
-
- else if (!g_strcmp0(event->type, "object:state-changed:checked")
+ } else if (!g_strcmp0(event->type, "object:state-changed:checked")
&& (get_objects_attributes(event->source) & ACCESSIBLE_READING_INFO_TYPE_STATE)) {
char buf[256] = "\0";
gchar *name = atspi_accessible_get_name(event->source, NULL);
if (!name) {
ERROR("name is null");
- return;
+ goto end;
}
g_strlcat(buf, name, sizeof(buf) - strlen(buf) - 1);
g_strlcat(buf, ", ", sizeof(buf) - strlen(buf) - 1);
gchar *name = atspi_accessible_get_name(event->source, NULL);
if (!name) {
ERROR("name is null");
- return;
+ goto end;
}
AtspiAccessible *parent = atspi_accessible_get_parent(event->source, NULL);
if (role == ATSPI_ROLE_MENU_ITEM) {
if (vc_get_keyboard_feedback()) {
if (role != ATSPI_ROLE_PASSWORD_TEXT && !g_strcmp0(event->type, "object:text-changed:insert")) {
- if (!_is_valid_status(event->detail2)) return;
+ if (!_is_valid_status(event->detail2))
+ goto end;
char buf[256] = "\0";
const gchar *text = NULL;
const gchar *symtext = NULL;
text = g_value_get_string(&event->any_data);
if (!text) {
ERROR("Received notification about NULL text insert");
- return;
+ goto end;
}
if ((event->detail2 == 1) && isupper((int)*text)) {
SUPPRESS_FORMAT_ERROR(g_snprintf(buf, sizeof(buf), _("IDS_ACCS_OPT_CAPITAL_PS_TTS"), text));
if (mode != 0)
tw_speak(buf, mode == 1);
- return;
+ goto end;
}
if (role == ATSPI_ROLE_ENTRY) {
if (!g_strcmp0(event->type, "object:text-changed:delete")) {
- if (!_is_valid_status(event->detail2)) return;
+ if (!_is_valid_status(event->detail2))
+ goto end;
char buf[256] = "\0";
char buf_deleted[256] = "\0";
const gchar *text = NULL;
text = g_value_get_string(&event->any_data);
if (!text) {
ERROR("Received notification about NULL text delete");
- return;
+ goto end;
}
if ((event->detail2 == 1) && isupper((int)*text))
SUPPRESS_FORMAT_ERROR(g_snprintf(buf, sizeof(buf), _("IDS_ACCS_OPT_CAPITAL_PS_TTS"), text));
}
} else if (role == ATSPI_ROLE_PASSWORD_TEXT) {
if ((!g_strcmp0(event->type, "object:text-changed:insert") || !g_strcmp0(event->type, "object:text-changed:delete"))) {
- if (!_is_valid_status(event->detail2)) return;
+ if (!_is_valid_status(event->detail2))
+ goto end;
AtspiText *iface_text = NULL;
char buf[64] = "\0";
iface_text = atspi_accessible_get_text_iface(event->source);
if (new_highlighted_obj && atd->new_obj_highlighted_callback && object_has_highlighted_state(new_highlighted_obj)) {
DEBUG("HIGHLIGHTED OBJECT IS ABOUT TO CHANGE");
atd->new_obj_highlighted_callback(new_highlighted_obj, role, atd->new_obj_highlighted_callback_user_data);
- g_object_unref(new_highlighted_obj);
- new_highlighted_obj = NULL;
}
DEBUG("END");
+end:
+ g_object_unref(new_highlighted_obj);
+ g_boxed_free(ATSPI_TYPE_EVENT, event);
}
App_Tracker_Data*
g_source_remove(atd->timer);
g_object_unref(atd->root);
+ g_free(atd->view_content_changed_ecd);
g_free(atd);
}
/* unset _scroll_gesture_requrired_obj */
_object_needs_scroll_gesture_send(atd, NULL);
+ g_object_unref(atd->root);
atd->root = root;
+ g_object_ref(atd->root);
+
timer_reschedule(atd);
}
#endif
return ret;
}
+static void destroy_atspi_relation_set(GArray *relations) {
+ /* This code bases on reverse engeenering of at-spi2-core */
+ for (int i = 0; i< relations->len; ++i) {
+ g_object_unref(g_array_index(relations, AtspiRelation*, i));
+ }
+ g_array_free(relations, TRUE);
+}
+
static AtspiAccessible *_get_object_in_relation(AtspiAccessible *source, AtspiRelationType search_type)
{
GArray *relations;
break;
}
}
- g_array_free(relations, TRUE);
+ destroy_atspi_relation_set(relations);
}
}
return ret;
return _directional_depth_first_search(ctx->root, NULL, SEARCH_BACKWARD, _accept_object);
}
-static AtspiAccessible *_navigate_by_one(FlatNaviContext *ctx, search_direction direction)
+static void _navigate_by_one(FlatNaviContext *ctx, search_direction direction)
{
if (direction != SEARCH_FORWARD && direction != SEARCH_BACKWARD) {
ERROR("invalid direction value (%d)", (int)direction);
- return ctx->current;
+ return;
}
DEBUG("START direction %s", direction == SEARCH_FORWARD ? "forward" : "backward");
- AtspiAccessible *root = ctx->root;
- AtspiAccessible *current = ctx->current;
- AtspiAccessible *ret = NULL;
-
- ret = _directional_depth_first_search(root, current, direction, _accept_object);
+ AtspiAccessible *ret = _directional_depth_first_search(ctx->root, ctx->current, direction, _accept_object);
- if (!ret || ret == current) {
+ if (!ret || ret == ctx->current) {
DEBUG("%s", direction == SEARCH_FORWARD ?
"Last item reached or failed" :
"first item reached or failed");
if (ctx->last_entry == (direction == SEARCH_FORWARD ? LAST_ENTRY_LAST : LAST_ENTRY_FIRST)) {
- ctx->current = (direction == SEARCH_FORWARD) ? _first(ctx) : _last(ctx);
+ AtspiAccessible *result = (direction == SEARCH_FORWARD) ? _first(ctx) : _last(ctx);
+ g_object_unref(ctx->current);
+ ctx->current = result;
ctx->last_entry = LAST_ENTRY_NONE;
}
else {
ctx->last_entry = direction == SEARCH_FORWARD ? LAST_ENTRY_LAST : LAST_ENTRY_FIRST;
}
+ g_object_unref(ret);
}
else {
+ g_object_unref(ctx->current);
ctx->current = ret;
ctx->last_entry = LAST_ENTRY_NONE;
}
char *unique_id = atspi_accessible_get_unique_id(ctx->current, NULL);
DEBUG("END item %s mode %d", unique_id, ctx->last_entry);
g_free(unique_id);
-
- return ret;
}
FlatNaviContext *flat_navi_context_create()
DEBUG("Creating navigation context for root = %s, root_name = %s", id, root_name);
g_free(id);
g_free(root_name);
+
+ g_object_unref(ctx->root);
ctx->root = root;
+ g_object_ref(ctx->root);
+
+ g_object_unref(ctx->current);
ctx->current = _first(ctx);
+
DEBUG("END");
return 0;
}
gchar *id = atspi_accessible_get_unique_id(root, NULL);
DEBUG("START - context root is changed to %s", id);
g_free(id);
+ g_object_unref(ctx->root);
ctx->root = root;
+ g_object_ref(ctx->root);
}
void flat_navi_context_free(FlatNaviContext *ctx)
{
if (!ctx)
return;
+ g_object_unref(ctx->root);
+ g_object_unref(ctx->current);
g_free(ctx);
}
return ctx->root;
}
-const AtspiAccessible *flat_navi_context_first_get(FlatNaviContext *ctx)
+AtspiAccessible *flat_navi_context_first_get(FlatNaviContext *ctx)
{
if (!ctx)
return NULL;
return _first(ctx);
}
-const AtspiAccessible *flat_navi_context_last_get(FlatNaviContext *ctx)
+AtspiAccessible *flat_navi_context_last_get(FlatNaviContext *ctx)
{
if (!ctx)
return NULL;
if (!ctx || !target)
return EINA_FALSE;
+ g_object_unref(ctx->current);
ctx->current = target;
+ g_object_ref(ctx->current);
return EINA_TRUE;
}
return NULL;
AtspiAccessible *ret = _first(ctx);
+
+ g_object_unref(ctx->current);
ctx->current = ret;
return ret;
return NULL;
AtspiAccessible *ret = _last(ctx);
+
+ g_object_unref(ctx->current);
ctx->current = ret;
return ret;
struct _KeyboardTrackerData
{
- AtspiDeviceListener *listener;
AtspiDeviceListener *async_listener;
Eldbus_Connection *conn;
Eldbus_Service_Interface *iface;
static gboolean async_keyboard_cb(const AtspiDeviceEvent *stroke, void *data)
{
DEBUG("AT-SPI DEVICE EVENT: ID(%d) STRING(%s) TYPE(%d) HW_CODE(%d) MODIFIERS(%d) TIMESTAMP(%d)", stroke->id, stroke->event_string, stroke->type, stroke->hw_code, stroke->modifiers, stroke->timestamp);
+
+ gboolean result = FALSE;
+
if (!g_strcmp0(stroke->event_string, "XF86Back")) {
tw_speak(_("MIDS_MH_BODY_BACK_BUTTON_T_TTS"), EINA_TRUE);
- return TRUE;
+ result = TRUE;
} else if (!g_strcmp0(stroke->event_string, "XF86PowerOff")) {
tw_purge(EINA_FALSE);
- return TRUE;
+ result = TRUE;
} else if (!g_strcmp0(stroke->event_string, "XF86AudioPause")) {
Eina_Bool paused = tw_pause_get();
tw_pause_set(!paused);
- return TRUE;
- } else
- return FALSE;
+ result = TRUE;
+ }
+
+ /* There is bug in the api. stroke does not point to const values */
+ g_boxed_free(ATSPI_TYPE_DEVICE_EVENT, (AtspiDeviceEvent*)stroke);
+
+ return result;
}
static void keyboard_changed_cb(keynode_t *node, void *user_data)
if (ktd->async_listener == NULL) {
ERROR("atspi_device_listener_new() failed, async_listener not set");
- free(ktd);
- return NULL;
+ goto fail_listener;
}
atspi_register_keystroke_listener(ktd->async_listener, NULL, 0, 1 << ATSPI_KEY_RELEASED_EVENT, ATSPI_KEYLISTENER_NOSYNC, NULL);
-
eldbus_init();
ktd->conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION);
if (ktd->conn == NULL) {
ERROR("ELDBUS CONNECTION NOT ESTABLISHED");
- free(ktd);
- return NULL;
+ goto fail_connection;
}
eldbus_name_request(ktd->conn, E_KEYBOARD_SERVICE_BUS_NAME, ELDBUS_NAME_REQUEST_FLAG_DO_NOT_QUEUE, NULL, NULL);
if (!ktd->iface) {
ERROR("ELDBUS INTERFACE NOT REGISTERED");
- free(ktd);
- return NULL;
+ goto fail_iface;
}
_set_vconf_key_changed_callback_keyboard_status(ktd);
DEBUG("keyboard tracker init");
return ktd;
+
+fail_iface:
+ eldbus_name_release(ktd->conn, E_KEYBOARD_SERVICE_BUS_NAME, NULL, NULL);
+ eldbus_connection_unref(ktd->conn);
+fail_connection:
+ eldbus_shutdown();
+ atspi_deregister_keystroke_listener(ktd->async_listener, NULL, 0, 1 << ATSPI_KEY_RELEASED_EVENT, NULL);
+ g_object_unref(ktd->async_listener);
+fail_listener:
+ free(ktd);
+ return NULL;
}
void keyboard_tracker_shutdown(KeyboardTrackerData *ktd)
if (ktd == NULL)
return;
- atspi_deregister_keystroke_listener(ktd->listener, NULL, 0, 1 << ATSPI_KEY_PRESSED, NULL);
atspi_deregister_keystroke_listener(ktd->async_listener, NULL, 0, 1 << ATSPI_KEY_RELEASED_EVENT, NULL);
+ g_object_unref(ktd->async_listener);
+ eldbus_service_interface_unregister(ktd->iface);
eldbus_name_release(ktd->conn, E_KEYBOARD_SERVICE_BUS_NAME, NULL, NULL);
eldbus_connection_unref(ktd->conn);
eldbus_shutdown();
Eldbus_Connection *conn;
Eldbus_Object *dobj;
Eldbus_Proxy *proxy;
- AtspiRect *rect = NULL;
- AtspiComponent *comp = NULL;
int highlighted_object_x = -1;
int highlighted_object_y = -1;
AtspiRole role = -1;
role = atspi_accessible_get_role(obj, NULL);
/* when you change this condition, check _current_highlight_object_set */
if (role != ATSPI_ROLE_POPUP_MENU && role != ATSPI_ROLE_DIALOG) { /* ctxpopup outline does not show highlight frame */
- comp = atspi_accessible_get_component_iface(obj);
- rect = atspi_component_get_extents(comp, ATSPI_COORD_TYPE_SCREEN, NULL);
+ AtspiComponent *comp = atspi_accessible_get_component_iface(obj);
+ AtspiRect *rect = atspi_component_get_extents(comp, ATSPI_COORD_TYPE_SCREEN, NULL);
+
highlighted_object_x = rect->x + rect->width / 2;
highlighted_object_y = rect->y + rect->height / 2;
+
+ g_boxed_free(ATSPI_TYPE_RECT, rect);
+ g_object_unref(comp);
}
keyboard_status = keyboard_event_status(nd->keyboard_tracker_data, info->x_end, info->y_end);
g_clear_object(&nd->current_comp);
g_clear_error(&err);
}
+ g_object_unref(nd->current_obj);
nd->current_obj = NULL;
DEBUG("END");
return;
/* Sync(set) current_comp, and current_obj.
The obj is about to grab highlight */
+ g_object_unref(nd->current_comp);
nd->current_comp = comp;
g_clear_object(&(nd->current_obj));
nd->current_obj = obj;
- flat_navi_context_current_set(nd->flat_navi_context, g_object_ref(nd->current_obj));
+ g_object_ref(nd->current_obj);
+ flat_navi_context_current_set(nd->flat_navi_context, nd->current_obj);
role = atspi_accessible_get_role(obj, NULL);
/* when you change this condition, check _send_highlighted_object_info */
TIZEN_PROD_STATIC void _focus_widget(NavigatorData *nd, Gesture_Info *info)
{
DEBUG("START");
+ AtspiAccessible *obj = NULL;
_window_at_point_check(nd, info->x_beg, info->y_beg);
if ((nd->last_focus.x == info->x_beg) && (nd->last_focus.y == info->y_beg))
return;
- AtspiAccessible *obj = NULL;
if (flat_navi_context_current_at_x_y_set(nd->flat_navi_context, info->x_beg, info->y_beg, &obj)) {
/* Need to check active_window_context->timer, other conditions could
increase number of IPC, if you need to reduce IPC count, then check the
active_window_context->timer only here in the future. */
AppTrackerContextValidility val = app_tracker_context_valid_check(nd->app_tracker_data);
if (val == APP_TRACKER_CONTEXT_NOT_VALID)
- return;
+ goto end;
_current_highlight_object_set(nd, obj, info->type == ONE_FINGER_SINGLE_TAP ? HIGHLIGHT_POINT_AGAIN : HIGHLIGHT_POINT);
}
-
+end:
+ g_object_unref(obj);
DEBUG("END");
}
TIZEN_PROD_STATIC void auto_review_highlight_set(NavigatorData *nd)
{
AtspiAccessible *obj = flat_navi_context_next(nd->flat_navi_context);
+ AtspiAccessible *ref = NULL;
DEBUG("START");
DEBUG("obj == NULL");
nd->auto_review_on = false;
return;
- } else if (obj == flat_navi_context_last_get(nd->flat_navi_context)) {
+ } else if (obj == (ref = flat_navi_context_last_get(nd->flat_navi_context))) {
DEBUG("obj == flat_navi_context_last_get()");
nd->auto_review_on = false;
}
+ g_object_unref(ref);
+
_current_highlight_object_set(nd, obj, HIGHLIGHT_FIRST);
DEBUG("END");
obj = atspi_accessible_get_child_at_index(parent, 0, NULL);
if (vc_get_sound_feedback())
smart_notification(FOCUS_CHAIN_END_NOTIFICATION_EVENT, 0, 0);
- }
-
- else {
+ } else {
DEBUG("go back to %d element", index);
obj = atspi_accessible_get_child_at_index(parent, index, NULL);
}
DEBUG("current obj set");
_current_highlight_object_set(nd, obj, HIGHLIGHT_FIRST);
}
+
+ g_object_unref(obj);
g_object_unref(parent);
g_object_unref(current);
}
}
AtspiAccessible *obj = NULL;
- AtspiComponent *comp = NULL;
- AtspiRect *rect = NULL;
gint total_distance = 0;
obj = nd->current_obj;
}
if (gi->state == 0) {
- comp = atspi_accessible_get_component_iface(obj);
+ AtspiComponent *comp = atspi_accessible_get_component_iface(obj);
if (!comp) {
ERROR("that slider do not have component interface");
nd->prepared = false;
return;
}
- rect = atspi_component_get_extents(comp, ATSPI_COORD_TYPE_SCREEN, NULL);
+ AtspiRect *rect = atspi_component_get_extents(comp, ATSPI_COORD_TYPE_SCREEN, NULL);
DEBUG("Current object is in:%d %d", rect->x, rect->y);
DEBUG("Current object has size:%d %d", rect->width, rect->height);
nd->slider_offset = 0.0;
g_object_unref(value_interface);
g_free(rect);
+ g_object_unref(comp);
}
if (gi->state == 1) {
DEBUG("HIGHLIGHT_NOTIFICATION_EVENT");
smart_notification(HIGHLIGHT_NOTIFICATION_EVENT, 0, 0);
}
+ g_object_unref(action);
}
if (vc_get_haptic())
AtspiComponent *comp = atspi_accessible_get_component_iface(nd->current_obj);
if (comp) {
atspi_component_clear_highlight(comp, &err);
+ g_object_unref(comp);
GERROR_CHECK(err);
}
}
app_tracker_shutdown(nd->app_tracker_data);
smart_notification_shutdown();
+ g_object_unref(nd->current_comp);
+ g_object_unref(nd->current_obj);
+
free(nd);
}
DEBUG("MAX VALUE REACHED");
if (asprintf(&text_to_read, "%.2f %s", current_temp_value, _("IDS_REACHED_MAX_VAL")) < 0) {
ERROR(MEMORY_ERROR);
+ g_object_unref(value_interface);
return NULL;
}
} else if (abs(current_temp_value - atspi_value_get_minimum_value(value_interface, NULL)) < EPS) {
DEBUG("MIN VALUE REACHED");
if (asprintf(&text_to_read, "%.2f %s", current_temp_value, _("IDS_REACHED_MIN_VAL")) < 0) {
ERROR(MEMORY_ERROR);
+ g_object_unref(value_interface);
return NULL;
}
} else {*/
if (asprintf(&text_to_read, "%.2f", current_temp_value) < 0) {
ERROR(MEMORY_ERROR);
+ g_object_unref(value_interface);
return NULL;
}
//}
+ g_object_unref(value_interface);
}
return text_to_read;
return ECORE_CALLBACK_CANCEL;
}
-void spi_event_listener_cb(AtspiEvent *event, void *user_data)
+static void spi_event_listener_cb(AtspiEvent *event, void *user_data)
{
DEBUG("START");
+
if (!user_data) {
ERROR("Invalid parameter");
- return;
+ goto end;
}
SpiData *spi = (SpiData *) user_data;
if (!spi->tracking_signal_name) {
ERROR("Invalid tracking signal name");
- return;
+ goto end;
}
DEBUG("Tracking signal - %s", spi->tracking_signal_name);
g_free(text_to_read);
g_free(desc_to_read);
DEBUG("END - No text to read");
- return;
+ goto end;
}
// continue function if cancel == 1 or signal_handling_timer == 0
- if (!cancel && spi->signal_handling_timer)
- return;
+ if (!cancel && spi->signal_handling_timer) {
+ g_free(text_to_read);
+ g_free(desc_to_read);
+ goto end;
+ }
// this function will free text_to_read and desc_to_read if fails
// (looks like very bad desing to me)
SignalHandlingTimerData *shtd = create_shtd(spi, event->source, text_to_read, desc_to_read);
if (!shtd) {
DEBUG("Error - create_shtd failed");
- return;
+ goto end;
}
DEBUG("Stop current reading and add timer");
if (!spi->signal_handling_timer) {
DEBUG("Error - ecore_timer_add failed");
free_shtd(shtd);
- return;
+ goto end;
}
DEBUG("END - Timer added (text:%s desc:%s source:%p)", text_to_read, desc_to_read ? desc_to_read : "null", event->source);
+end:
+ g_boxed_free(ATSPI_TYPE_EVENT, event);
}
/**
system_data->tapi_handle[i] = tel_init(cp_list[i]);
DEBUG("CP_LIST %d = %s", i, cp_list[i]);
}
+
+ for (i = 0; cp_list[i]; ++i)
+ g_free(cp_list[i]);
+
+ g_free(cp_list);
}
/**
DEBUG("******************** START ********************");
int ret = -1;
- System_Data *system_data = malloc(sizeof(System_Data));
+ System_Data *system_data = calloc(sizeof(System_Data), 1);
if (!system_data) {
ERROR("malloc(%zu) failed", sizeof(System_Data));
if (ret != BT_ERROR_NONE)
ERROR("ret == %d", ret);
- if (system_data) {
- if (system_data->wifi) {
- ret = wifi_manager_deinitialize(system_data->wifi);
- if (ret != WIFI_MANAGER_ERROR_NONE)
- ERROR("wifi ret == %d", ret);
- }
+ if (!system_data)
+ return;
+
+ if (system_data->wifi) {
+ ret = wifi_manager_deinitialize(system_data->wifi);
+ if (ret != WIFI_MANAGER_ERROR_NONE)
+ ERROR("wifi ret == %d", ret);
+ }
- system_data->wifi = NULL;
- free(system_data);
+ for (int i=0; i<(MAX_SIM_COUNT+1) && system_data->tapi_handle[i]; ++i) {
+ tel_deinit(system_data->tapi_handle[i]);
}
+ system_data->wifi = NULL;
+ free(system_data);
+
return;
}
{
DEBUG("START");
int count_child, jdx;
- AtspiAccessible *child_iter;
AtspiStateType state = ATSPI_STATE_SHOWING;
if (!scrollable_object) {
count_child = atspi_accessible_get_child_count(scrollable_object, NULL);
for (jdx = 0; jdx < count_child; jdx++) {
- child_iter = atspi_accessible_get_child_at_index(scrollable_object, jdx, NULL);
- if (!child_iter)
+ AtspiAccessible *child = atspi_accessible_get_child_at_index(scrollable_object, jdx, NULL);
+ if (!child)
continue;
- AtspiStateSet *state_set = atspi_accessible_get_state_set(child_iter);
+ AtspiStateSet *state_set = atspi_accessible_get_state_set(child);
gboolean is_visible = atspi_state_set_contains(state_set, state);
+
g_clear_object(&state_set);
+ g_object_unref(child);
if (is_visible) {
*start_idx = jdx;
static void _scroll_event_cb(AtspiEvent *event, gpointer user_data)
{
if (!status)
- return;
+ goto end;
int start_index, end_index;
start_index = 0;
get_realized_items_count((AtspiAccessible *) event->source, &start_index, &end_index);
_smart_notification_realized_items(start_index, end_index);
}
+end:
+ g_boxed_free(ATSPI_TYPE_EVENT, event);
}
/**
}
GError *err = NULL;
AtspiRect *rect = atspi_component_get_extents(comp, ATSPI_COORD_TYPE_SCREEN, &err);
+ g_object_unref(comp);
GERROR_CHECK(err);
if (!rect) {
DEBUG("purging because failed to get extents");
/* should be ATSPI_COORD_TYPE_SCREEN, but it seems that evas_object_geometry
would be same with ecore_evas_geometry for window. so the value is doubled */
rect = atspi_component_get_extents(comp, ATSPI_COORD_TYPE_SCREEN, NULL);
+ g_object_unref(comp);
wi = g_malloc0(sizeof(WindowInfo));
if (!wi) {
(window_activate_info_type & ACCESSIBLE_WINDOW_ACTIVATE_INFO_KEYBOARD);
if (keyboard_window_activated) {
wtd->keyboard_window = g_object_ref(event->source);
- g_free(name);
- return;
+ goto end;
}
_window_append(wtd, event->source, EINA_TRUE, EINA_FALSE, window_activate_info_type);
wtd->subroot = NULL; //No need to keep subroot if any window gets activated
}
}
}
+end:
g_free(name);
+ g_boxed_free(ATSPI_TYPE_EVENT, event);
}
WindowTrackerData *window_tracker_init(void)