Esempio n. 1
0
void wyNode::unscheduleLocked(wyTimer* t) {
    // explicit null handling
    if(t == NULL) {
        LOGW("node unschedule: timer must be non-null");
        return;
    }

    // no timer scheduled?
    if(m_timers == NULL)
        return;

    // doesn't contain this timer?
    if(wyArrayIndexOf(m_timers, t, wyTimerEquals, NULL) == -1)
        return;

    pthread_mutex_lock(&gMutex);

    // delete t from array
    // there is a little hack to ensure the deleted timer is released
    wyTimer* deletedTimer = (wyTimer*)wyArrayDeleteObj(m_timers, t, wyTimerEquals, NULL);

    // unschedule this timer
    if(m_running)
        gScheduler->unscheduleLocked(t);

    // release the timer because we retained it before
    wyObjectRelease(deletedTimer);

    pthread_mutex_unlock(&gMutex);
}
Esempio n. 2
0
void wyPageControl::removePage(wyNode* page) {
	int index = wyArrayIndexOf(m_pages, page, NULL, NULL);
	if(wyArrayDeleteObj(m_pages, page, NULL, NULL) != NULL) {
		// remove from container
		m_container->removeChildLocked(page, true);

		// notify indicator before page is released
		if(m_indicator)
			m_indicator->onPageRemoved(page, index);

		// release page and update positions
		page->release();
		updatePagePositions();
	}
}