| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 1 | |
Gordon Schumacher wrote: >Um... after running "grep" on the doc directory and finding that macro >only in the code for one example, I am guessing that Q_GLOBAL_STATIC is >how you are supposed to declare a static Q_OBJECT so that it is actually >cleaned up properly? That might address the Win32 resource leak that I >was seeing... No. Q_GLOBAL_STATIC is not a documented macro, so it's not public. If you use it, you're at your own risk. But I can tell you what it does, so you may write a replacement if needed: - it returns a pointer to the object type - that pointer is allocated on first use - the pointer is set atomically, guaranteeing that all threads return the same value (in other words, it's thread-safe) - the pointer is cleaned up by a static deleter A function-static object may work in platforms where global-static objects don't. I don't know if that's the case on Windows... But you could experiment by deleting the objects yourself through your own implementation of a "delete me when you unload" code. >If I have that right, would you mind explaining why it works this way? >I have tried looking at the code but the QObject code kind of hurts my >head to read :) > >(Don't get me wrong, it's impressive stuff - just not easy to understand >if you don't already know what you're looking for!) I don't understand what you mean. -- [ signature omitted ]
Attachment:
signature.asc
Description: This is a digitally signed message part.