Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Subclassing QAbstractEventDispatcher and implementing unregisterTimer.
Qt 6.11 is out! See what's new in the release blog

Subclassing QAbstractEventDispatcher and implementing unregisterTimer.

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    abzze
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved