Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong flag cleared when disarmed event #6

Closed
wants to merge 3 commits into from

Conversation

casaroli
Copy link

No description provided.

@quantum-leaps
Copy link
Contributor

quantum-leaps commented Mar 30, 2020

Thank you for reporting. Double disarming of a time event was not tested in QP/C, but indeed the wrong flag has been cleared in the [else] branch within QTimer_disarm(). The correct code is as follows:

    ~ ~ ~
    else { /* the time event was already disarmed automatically */
        wasArmed = false;
        me->super.refCtr_ &= (uint8_t)(~TE_WAS_DISARMED & 0xFFU);
        ~ ~ ~

The fix will be applied to QP/C and it will be re-released as 6.8.0.

The problem is NOT present in QP/C++.

Finally, regarding the WAS_DISARMED flag, it is checked in the QTimeEvt_wasDisarmed() API. This API is potentially useful for clients to check whether a (one shot) time event was indeed disarmed manually, or perhaps it was disarmed automatically. In the latter case the client code must be prepared to receive the time event, because it is already in the event queue.

--MMS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants