示例#1
0
void ReferenceCounter::PrintDebug(void)
{
    QReadLocker locker(&leakLock);

    uint cnt = 0;
    QMap<ReferenceCounter*,LeakInfo>::iterator it = leakMap.begin();
    for (; it != leakMap.end(); ++it)
        cnt += (*it).name.startsWith("CommandLineArg") ? 0 : 1;

    LOG((cnt) ? VB_GENERAL : VB_REFCOUNT, LOG_INFO,
        QString("Leaked %1 reference counted objects").arg(cnt));

    for (it = leakMap.begin(); it != leakMap.end(); ++it)
    {
        if ((*it).name.startsWith("CommandLineArg"))
            continue;
        LOG(VB_REFCOUNT, LOG_INFO,
            QString("  Leaked %1(0x%2) reference count %3")
            .arg((*it).name)
            .arg(reinterpret_cast<intptr_t>(it.key()),0,16)
            .arg((*it).refCount));
/// This part will not work on some non-Linux machines..
#if defined(__linux__) || defined(__LINUX__)
        MythImage *img = NULL;
        if ((*it).name.startsWith("MythImage") ||
            (*it).name.startsWith("MythQtImage"))
        {
            img = reinterpret_cast<MythImage*>(it.key());
        }
        if (img)
        {
            LOG(VB_REFCOUNT, LOG_INFO,
                QString("  Image id %1 cache size %2 file '%3'")
                .arg(img->GetID())
                .arg(img->GetCacheSize())
                .arg(img->GetFileName()));
        }
#endif
///
    }
}