Subclassing QAbstractEventDispatcher and implementing unregisterTimer.



  • I subclassed QAbstractEventDispatcher, lets call it MyEventDispatcher.
    I implemented functions:

    void registerTimer(int timerId, int interval, QObject *object);
    bool unregisterTimer(int timerId);
    (There are others, but these two are relevant to this bug).

    Now when Qt starts a timer function:
    QAbstractEventDispatcher:: registerTimer(int interval, QObject *object); is called.
    Which allocates a timerID using QAbstractEventDispatcherPrivate::allocateTimerId();.

    Now when the timer is stopped,
    MyEventDispatcher::unregisterTimer(int timerId) is called.
    From my implementation of the function, since it's not a part of qt source code, I have no way of calling QAbstractEventDispatcherPrivate::releaseTimerId(int timerId).

    So, over the course of running my app, it keeps allocating int array of exponentially increasing sizes, and eventually runs out of timerIds to allocate once it reaches 8^8 timerIds.

    I already logged a bug report for this: https://bugreports.qt.nokia.com/browse/QTBUG-22794.

    But maybe I am missing something very obvious here, or doing something wrong in the implementation of MyEventDispatcher?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.