Sometimes g_boject_ref/unref are called with NULL object.
Change-Id: Ia9ca8b341fc78a9481f201f29d936bdb15100b07
{
DEBUG("START");
App_Tracker_Data *atd = (App_Tracker_Data*)data;
+ if (!atd->read_timer_user_data) return ECORE_CALLBACK_CANCEL;
+
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);
if (atd->read_timer)
ecore_timer_del(atd->read_timer);
- g_object_unref(atd->read_timer_user_data);
+ if (atd->read_timer_user_data)
+ g_object_unref(atd->read_timer_user_data);
atd->read_timer_user_data = new_highlighted_obj;
g_object_ref(atd->read_timer_user_data);
ecore_timer_del(atd->read_timer);
atd->read_timer = NULL;
- g_object_unref(atd->read_timer_user_data);
+ if (atd->read_timer_user_data)
+ g_object_unref(atd->read_timer_user_data);
atd->read_timer_user_data = NULL;
}
}
DEBUG("END");
end:
- g_object_unref(new_highlighted_obj);
+ if (new_highlighted_obj) g_object_unref(new_highlighted_obj);
g_boxed_free(ATSPI_TYPE_EVENT, event);
}
/* unset _scroll_gesture_requrired_obj */
_object_needs_scroll_gesture_send(atd, NULL);
- g_object_unref(atd->root);
+ if (atd->root) g_object_unref(atd->root);
atd->root = root;
g_object_ref(atd->root);
static void _on_chain_end_loop(FlatNaviContext *ctx, search_direction direction)
{
AtspiAccessible *result = (direction == SEARCH_FORWARD) ? _first(ctx) : _last(ctx);
- g_object_unref(ctx->current);
+ if (ctx->current) g_object_unref(ctx->current);
ctx->current = result;
ctx->last_entry = LAST_ENTRY_NONE;
}
ctx->last_entry = direction == SEARCH_FORWARD ? LAST_ENTRY_LAST : LAST_ENTRY_FIRST;
}
- g_object_unref(ret);
+ if (ret) g_object_unref(ret);
}
else {
- g_object_unref(ctx->current);
+ if (ctx->current) g_object_unref(ctx->current);
ctx->current = ret;
ctx->last_entry = LAST_ENTRY_NONE;
}
ctx->root = root;
g_object_ref(ctx->root);
- g_object_unref(ctx->current);
+ if (ctx->current) g_object_unref(ctx->current);
if (_return_to_old_root(old_root)) {
DEBUG("Will return to old root");
ctx->current = old_root;
} else {
- g_object_unref(old_root);
+ if (old_root) g_object_unref(old_root);
ctx->current = _first(ctx);
}
ctx->last_entry = LAST_ENTRY_NONE;
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);
+ if (ctx->root) g_object_unref(ctx->root);
ctx->root = root;
g_object_ref(ctx->root);
}
if (!ctx || !target)
return EINA_FALSE;
- g_object_unref(ctx->current);
+ if (ctx->current) g_object_unref(ctx->current);
ctx->current = target;
g_object_ref(ctx->current);
AtspiAccessible *ret = _first(ctx);
- g_object_unref(ctx->current);
+ if (ctx->current) g_object_unref(ctx->current);
ctx->current = ret;
return ret;
AtspiAccessible *ret = _last(ctx);
- g_object_unref(ctx->current);
+ if (ctx->current) g_object_unref(ctx->current);
ctx->current = ret;
return ret;
g_clear_object(&nd->current_comp);
g_clear_error(&err);
}
- g_object_unref(nd->current_obj);
+ if (nd->current_obj)
+ g_object_unref(nd->current_obj);
nd->current_obj = NULL;
DEBUG("END");
return;
DEBUG("clearing highlight for %s", id);
g_free(id);
atspi_component_clear_highlight(nd->current_comp, &err);
+ g_object_unref(nd->current_comp);
}
/* 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;
_current_highlight_object_set(nd, obj, info->type == ONE_FINGER_SINGLE_TAP ? HIGHLIGHT_POINT_AGAIN : HIGHLIGHT_POINT);
}
end:
- g_object_unref(obj);
+ if (obj) g_object_unref(obj);
DEBUG("END");
}
nd->auto_review_on = false;
}
- g_object_unref(ref);
+ if (ref) g_object_unref(ref);
_current_highlight_object_set(nd, obj, HIGHLIGHT_FIRST);
if (flat_navi_context_current_set(nd->flat_navi_context, obj))
DEBUG("current obj set");
_current_highlight_object_set(nd, obj, HIGHLIGHT_FIRST);
+ g_object_unref(obj);
}
- g_object_unref(obj);
g_object_unref(parent);
g_object_unref(current);
}
if (flat_navi_context_current_set(nd->flat_navi_context, obj))
DEBUG("current obj set");
_current_highlight_object_set(nd, obj, HIGHLIGHT_LAST);
+ g_object_unref(obj);
}
g_object_unref(parent);
g_object_unref(current);
return;
}
- AtspiAccessible *old_root = g_object_ref(flat_navi_context_root_get(nd->flat_navi_context));
+ AtspiAccessible *old_root = NULL;
+ if (flat_navi_context_root_get(nd->flat_navi_context))
+ old_root = g_object_ref(flat_navi_context_root_get(nd->flat_navi_context));
if (flat_navi_context_setup(nd->flat_navi_context, root)) {
DEBUG("END -- setup failed");
- g_object_unref(old_root);
+ if (old_root) g_object_unref(old_root);
return;
}
AtspiAccessible *new_current = flat_navi_context_current_get(nd->flat_navi_context);
// when returning to old context root as current in new context we should highlight the current immediately without providing default label
default_label_enabled = EINA_FALSE;
}
- g_object_unref(old_root);
+ if (old_root) g_object_unref(old_root);
if (default_label_enabled) {
_current_highlight_object_set(nd, NULL, HIGHLIGHT_FIRST);
if (action) {
DEBUG("HIGHLIGHT_NOTIFICATION_EVENT_ACTIONABLE");
smart_notification(HIGHLIGHT_NOTIFICATION_EVENT_ACTIONABLE, 0, 0);
+ g_object_unref(action);
} else {
DEBUG("HIGHLIGHT_NOTIFICATION_EVENT");
smart_notification(HIGHLIGHT_NOTIFICATION_EVENT, 0, 0);
}
- g_object_unref(action);
}
if (vc_get_haptic())
app_tracker_shutdown(nd->app_tracker_data);
smart_notification_shutdown();
- g_object_unref(nd->current_comp);
- g_object_unref(nd->current_obj);
+ if (nd->current_comp) g_object_unref(nd->current_comp);
+ if (nd->current_obj) g_object_unref(nd->current_obj);
free(nd);
}
// by eina_strbuf_string_steal().
free(command->context.text);
}
- g_object_unref(command->obj);
+ if (command->obj) g_object_unref(command->obj);
g_free(command);
}
}
rc->discardable = discardable;
rc->want_discard_previous_reading = want_discard_previous_reading;
rc->is_playing = EINA_FALSE;
- rc->obj = g_object_ref(obj);
+ if (obj) rc->obj = g_object_ref(obj);
rc->time_to_speak = 0;
rc->delay_to_speak = delay;
if (delay) {