Ignore:
Timestamp:
Mar 8, 2010, 12:52:58 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.2 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/image/qpixmap.cpp

    r561 r651  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    321321{
    322322    Q_ASSERT(!data || data->ref >= 1); // Catch if ref-counting changes again
    323     if (data && data->is_cached && data->ref == 1) // ref will be decrememnted after destructor returns
    324         QImagePixmapCleanupHooks::executePixmapDestructionHooks(this);
    325323}
    326324
     
    834832        return true;
    835833
    836     QPixmapData *tmp = QPixmapData::create(0, 0, QPixmapData::PixmapType);
    837     if (tmp->fromFile(fileName, format, flags)) {
    838         data = tmp;
     834    bool ok;
     835
     836    if (data) {
     837        ok = data->fromFile(fileName, format, flags);
     838    } else {
     839        QScopedPointer<QPixmapData> tmp(QPixmapData::create(0, 0, QPixmapData::PixmapType));
     840        ok = tmp->fromFile(fileName, format, flags);
     841        if (ok)
     842            data = tmp.take();
     843    }
     844
     845    if (ok)
    839846        QPixmapCache::insert(key, *this);
    840         return true;
    841     }
    842     delete tmp;
    843     return false;
     847
     848    return ok;
    844849}
    845850
     
    10191024        return 0;
    10201025
    1021     int classKey = data->classId();
    1022     if (classKey >= 1024)
    1023         classKey = -(classKey >> 10);
    1024     return ((((qint64) classKey) << 56)
    1025             | (((qint64) data->serialNumber()) << 32)
    1026             | ((qint64) (data->detach_no)));
     1026    Q_ASSERT(data);
     1027    return data->cacheKey();
    10271028}
    10281029
     
    19391940
    19401941    if (data->is_cached && data->ref == 1)
    1941         QImagePixmapCleanupHooks::executePixmapModificationHooks(this);
     1942        QImagePixmapCleanupHooks::executePixmapDataModificationHooks(data.data());
    19421943
    19431944#if defined(Q_WS_MAC)
Note: See TracChangeset for help on using the changeset viewer.