Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.3 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/corelib/kernel/qabstractitemmodel.cpp

    r651 r769  
    10061006    Returns the child of the model index that is stored in the given \a row and
    10071007    \a column.
     1008
     1009
     1010
    10081011
    10091012    \sa parent(), sibling()
  • trunk/src/corelib/kernel/qcore_symbian_p.cpp

    r651 r769  
    7272    return QString::fromLocal8Bit(aDescriptor.Ptr(), aDescriptor.Length());
    7373#else
    74     return QString::fromUtf16(aDescriptor.Ptr(), aDescriptor.Length());
     74    return QString), aDescriptor.Length());
    7575#endif
    7676}
     
    133133    {
    134134#ifdef Q_WS_S60
    135         _LIT(KLibName_3_1, "qts60plugin_3_1.dll");
    136         _LIT(KLibName_3_2, "qts60plugin_3_2.dll");
    137         _LIT(KLibName_5_0, "qts60plugin_5_0.dll");
     135        _LIT(KLibName_3_1, "qts60plugin_3_1" QT_LIBINFIX_UNICODE L".dll");
     136        _LIT(KLibName_3_2, "qts60plugin_3_2" QT_LIBINFIX_UNICODE L".dll");
     137        _LIT(KLibName_5_0, "qts60plugin_5_0" QT_LIBINFIX_UNICODE L".dll");
     138
    138139        TPtrC libName;
    139140        TInt uidValue;
  • trunk/src/corelib/kernel/qcore_symbian_p.h

    r651 r769  
    6060#include <qhash.h>
    6161#include <f32file.h>
     62
     63
     64
     65
     66
     67
     68
     69
     70
    6271
    6372QT_BEGIN_HEADER
  • trunk/src/corelib/kernel/qcoreapplication.cpp

    r651 r769  
    6868#  include <exception>
    6969#  include <f32file.h>
     70
    7071#  include "qeventdispatcher_symbian_p.h"
    7172#  include "private/qcore_symbian_p.h"
     
    597598    extern void qt_core_eval_init(uint);
    598599    qt_core_eval_init(d->application_type);
     600
     601
     602
     603
     604
     605
     606
     607
     608
     609
     610
     611
     612
     613
     614
     615
     616
     617
     618
     619
     620
    599621#endif
    600622
     
    22502272            TInt err = finder.FindByDir(tempPathPtr, tempPathPtr);
    22512273            while (err == KErrNone) {
    2252                 QString foundDir = QString::fromUtf16(finder.File().Ptr(), finder.File().Length());
     2274                QString foundDir(reinterpret_cast<const QChar *>(finder.File().Ptr()),
     2275                                 finder.File().Length());
    22532276                foundDir = QDir(foundDir).canonicalPath();
    22542277                if (!app_libpaths->contains(foundDir))
  • trunk/src/corelib/kernel/qeventdispatcher_symbian.cpp

    r651 r769  
    4444#include <qcoreapplication.h>
    4545#include <private/qcoreapplication_p.h>
    46 #include <qdatetime.h>
    4746
    4847#include <unistd.h>
    4948#include <errno.h>
    5049
     50
     51
    5152QT_BEGIN_NAMESPACE
     53
     54
     55
     56
     57
     58
     59
    5260
    5361#define WAKE_UP_PRIORITY CActive::EPriorityStandard
     
    93101{
    94102public:
    95     QSelectMutexGrabber(int fd, QMutex *mutex)
    96         : m_mutex(mutex)
     103    QSelectMutexGrabber(int fd, QMutex *utex)
     104        : m_)
    97105    {
    98         if (m_mutex->tryLock())
     106        // see if selectThread is waiting m_waitCond
     107        // if yes ... dont write to pipe
     108        if (m_threadMutex->tryLock()) {
     109            bHasThreadLock = true;
    99110            return;
     111
     112
     113
     114
     115
     116
     117
     118
    100119
    101120        char dummy = 0;
    102121        qt_pipe_write(fd, &dummy, 1);
    103122
    104         m_mutex->lock();
     123        m_threadMutex->lock();
     124        bHasThreadLock = true;
    105125    }
    106126
    107127    ~QSelectMutexGrabber()
    108128    {
    109         m_mutex->unlock();
     129        if(bHasThreadLock)
     130            m_threadMutex->unlock();
    110131    }
    111132
    112133private:
    113     QMutex *m_mutex;
     134    QMutex *m_threadMutex;
     135    QMutex *m_selectCallMutex;
     136    bool bHasThreadLock;
    114137};
    115138
     
    393416        int ret;
    394417        int savedSelectErrno;
    395         ret = qt_socket_select(maxfd, &readfds, &writefds, &exceptionfds, 0);
     418        {
     419            // helps fighting the race condition between
     420            // selctthread and new socket requests (cancel, restart ...)
     421            QMutexLocker locker(&m_selectCallMutex);
     422            ret = qt_socket_select(maxfd, &readfds, &writefds, &exceptionfds, 0);
     423        }
    396424        savedSelectErrno = errno;
    397425
     
    457485
    458486                // traversed all, so update
     487
    459488                updateActivatedNotifiers(QSocketNotifier::Read, &readfds);
    460489                updateActivatedNotifiers(QSocketNotifier::Write, &writefds);
    461                 updateActivatedNotifiers(QSocketNotifier::Exception, &exceptionfds);
    462490
    463491                break;
     
    469497            }
    470498        } else {
     499
    471500            updateActivatedNotifiers(QSocketNotifier::Read, &readfds);
    472501            updateActivatedNotifiers(QSocketNotifier::Write, &writefds);
    473             updateActivatedNotifiers(QSocketNotifier::Exception, &exceptionfds);
    474502        }
    475503
     
    488516    }
    489517
    490     QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex);
     518    QMutexLocker locker(&m_grabberMutex);
     519
     520    QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex);
    491521
    492522    Q_ASSERT(!m_AOStatuses.contains(notifier));
     
    499529void QSelectThread::cancelSocketEvents ( QSocketNotifier *notifier )
    500530{
    501     QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex);
     531    QMutexLocker locker(&m_grabberMutex);
     532
     533    QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex);
    502534
    503535    m_AOStatuses.remove(notifier);
     
    508540void QSelectThread::restart()
    509541{
    510     QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex);
     542    QMutexLocker locker(&m_grabberMutex);
     543
     544    QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex, &m_selectCallMutex);
    511545
    512546    m_waitCond.wakeAll();
     
    564598             * then signal RequestComplete for it
    565599             */
    566             qWarning("exception on %d", i.key()->socket());
     600            qWarning("exception on %d [will do setdefaultif(0) - hack]", i.key()->socket());
     601            // quick fix; there is a bug
     602            // when doing read on socket
     603            // errors not preoperly mapped
     604            // after offline-ing the device
     605            // on some devices we do get exception
     606            // close all exiting sockets
     607            // and reset default IAP
     608            if(::setdefaultif(0) != KErrNone) // well we can't do much about it
     609                qWarning("setdefaultif(0) failed");
     610
    567611            toRemove.append(i.key());
    568612            TRequestStatus *status = i.value();
     
    623667    }
    624668}
     669
     670
     671
     672
     673
     674
     675
     676
     677
     678
     679
     680
     681
     682
     683
     684
     685
     686
     687
     688
     689
     690
     691
     692
     693
     694
     695
     696
     697
     698
     699
     700
     701
     702
     703
     704
     705
     706
     707
     708
     709
     710
     711
     712
     713
     714
     715
     716
     717
     718
     719
     720
     721
     722
     723
     724
     725
     726
     727
     728
     729
     730
     731
     732
     733
     734
     735
     736
    625737
    626738QEventDispatcherSymbian::QEventDispatcherSymbian(QObject *parent)
     
    634746      m_noSocketEvents(false)
    635747{
     748
     749
     750
     751
     752
    636753}
    637754
    638755QEventDispatcherSymbian::~QEventDispatcherSymbian()
    639756{
    640     m_processHandle.Close();
    641757}
    642758
     
    698814        m_interrupt = false;
    699815
    700         /*
    701          * This QTime variable is used to measure the time it takes to finish
    702          * the event loop. If we take too long in the loop, other processes
    703          * may be starved and killed. After the first event has completed, we
    704          * take the current time, and if the remaining events take longer than
    705          * a preset time, we temporarily lower the priority to force a context
    706          * switch. For applications that do not take unecessarily long in the
    707          * event loop, the priority will not be altered.
    708          */
    709         QTime time;
    710         enum {
    711             FirstRun,
    712             SubsequentRun,
    713             TimeStarted
    714         } timeState = FirstRun;
    715 
    716         TProcessPriority priority;
     816#ifdef QT_SYMBIAN_PRIORITY_DROP
     817        QTime eventTimer;
     818#endif
    717819
    718820        while (1) {
     
    728830            }
    729831
    730             if (timeState == SubsequentRun) {
    731                 time.start();
    732                 timeState = TimeStarted;
     832#ifdef QT_SYMBIAN_PRIORITY_DROP
     833            if (idleDetectorThread()->hasRun()) {
     834                if (m_delay > baseDelay)
     835                    m_delay -= baseDelay;
     836                m_lastIdleRequestTimer.start();
     837                idleDetectorThread()->kick();
     838            } else if (m_lastIdleRequestTimer.elapsed() > maxBusyTime) {
     839                User::AfterHighRes(m_delay);
     840                // allow delay to be up to 1/4 of execution time
     841                if (!idleDetectorThread()->hasRun() && m_delay*3 < m_avgEventTime)
     842                    m_delay += baseDelay;
    733843            }
     844
     845
    734846
    735847            TInt error;
    736             handledSymbianEvent = CActiveScheduler::RunIfReady(error, CActive::EPriorityIdle);
     848            handledSymbianEvent = CActiveScheduler::RunIfReady(error, );
    737849            if (error) {
    738850                qWarning("CActiveScheduler::RunIfReady() returned error: %i\n", error);
    739851                CActiveScheduler::Current()->Error(error);
    740852            }
     853
     854
     855
     856
     857
     858
    741859
    742860            if (!handledSymbianEvent) {
     
    748866            }
    749867            block = false;
    750             if (timeState == TimeStarted && time.elapsed() > 100) {
    751                 priority = m_processHandle.Priority();
    752                 m_processHandle.SetPriority(EPriorityBackground);
    753                 time.start();
    754                 // Slight chance of race condition in the next lines, but nothing fatal
    755                 // will happen, just wrong priority.
    756                 if (m_processHandle.Priority() == EPriorityBackground) {
    757                     m_processHandle.SetPriority(priority);
    758                 }
    759             }
    760             if (timeState == FirstRun)
    761                 timeState = SubsequentRun;
    762868        };
    763869
  • trunk/src/corelib/kernel/qeventdispatcher_symbian_p.h

    r651 r769  
    6363#include <qwaitcondition.h>
    6464#include <qsocketnotifier.h>
     65
    6566
    6667#include <e32base.h>
     
    211212    QWaitCondition m_waitCond;
    212213    bool m_quit;
     214
     215
     216
     217
     218
     219
     220
     221
     222
     223
     224
     225
     226
     227
     228
     229
     230
     231
     232
     233
    213234};
    214235
     
    280301    QList<QActiveObject *> m_deferredActiveObjects;
    281302
    282     RProcess m_processHandle;
     303    int m_delay;
     304    int m_avgEventTime;
     305    QTime m_lastIdleRequestTimer;
    283306};
    284307
  • trunk/src/corelib/kernel/qeventdispatcher_win.cpp

    r651 r769  
    6969#endif
    7070
     71
     72
     73
     74
     75
     76
     77
     78
    7179enum {
    7280    WM_QT_SOCKETNOTIFIER = WM_USER,
     
    503511                if (localSerialNumber != d->lastSerialNumber
    504512                    // if this message IS the one that triggers sendPostedEvents(), no need to post it again
    505                     && msg->hwnd != d->internalHwnd
    506                     && msg->message != WM_QT_SENDPOSTEDEVENTS) {
     513                    && msg->hwnd != d->internalHwnd
     514                    ) {
    507515                    PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0);
    508516                }
     
    715723                        || msg.message == WM_MOUSEWHEEL
    716724                        || msg.message == WM_MOUSEHWHEEL
     725
     726
     727
    717728                        || msg.message == WM_CLOSE)) {
    718729                    // queue user input events for later processing
  • trunk/src/corelib/kernel/qfunctions_wince.cpp

    r651 r769  
    353353    size_t high = num - 1;
    354354    while (low <= high) {
    355         unsigned int mid = ((unsigned) (low + high)) >> 1;
     355        ) >> 1;
    356356        int c = compare(key, (char*)base + mid * size);
    357         if (c < 0)
     357        if (c < 0) {
     358            if (!mid)
     359                break;
    358360            high = mid - 1;
    359         else if (c > 0)
     361        else if (c > 0)
    360362            low = mid + 1;
    361363        else
    362364            return (char*) base + mid * size;
    363365    }
    364     return (NULL);
     366    return ;
    365367}
    366368
  • trunk/src/corelib/kernel/qmetaobject.cpp

    r651 r769  
    944944        return result;
    945945
    946     QVarLengthArray<char> stackbuf(int(strlen(type)) + 1);
     946    QVarLengthArray<char> stackbuf() + 1);
    947947    qRemoveWhitespace(type, stackbuf.data());
    948948    int templdepth = 0;
  • trunk/src/corelib/kernel/qobject.cpp

    r651 r769  
    32653265            const int method = c->method;
    32663266            QObjectPrivate::Sender currentSender;
    3267             currentSender.sender = sender;
    3268             currentSender.signal = signal_absolute_index;
    3269             currentSender.ref = 1;
     3267            const bool receiverInSameThread = currentThreadData == receiver->d_func()->threadData;
    32703268            QObjectPrivate::Sender *previousSender = 0;
    3271             if (currentThreadData == receiver->d_func()->threadData)
     3269            if (receiverInSameThread) {
     3270                currentSender.sender = sender;
     3271                currentSender.signal = signal_absolute_index;
     3272                currentSender.ref = 1;
    32723273                previousSender = QObjectPrivate::setCurrentSender(receiver, &currentSender);
     3274
    32733275            locker.unlock();
    32743276
     
    32863288            } QT_CATCH(...) {
    32873289                locker.relock();
    3288 
    3289                 QObjectPrivate::resetCurrentSender(receiver, &currentSender, previousSender);
     3290                if (receiverInSameThread)
     3291                QObjectPrivate::resetCurrentSender(receiver, &currentSender, previousSender);
    32903292
    32913293                --connectionLists->inUse;
     
    33023304            locker.relock();
    33033305
    3304             QObjectPrivate::resetCurrentSender(receiver, &currentSender, previousSender);
     3306            if (receiverInSameThread)
     3307                QObjectPrivate::resetCurrentSender(receiver, &currentSender, previousSender);
    33053308
    33063309            if (connectionLists->orphaned)
  • trunk/src/corelib/kernel/qobjectdefs.h

    r651 r769  
    7979#define Q_INTERFACES(x)
    8080#define Q_PROPERTY(text)
     81
    8182#define Q_OVERRIDE(text)
    8283#define Q_ENUMS(x)
     
    179180#define Q_INTERFACES(x) Q_INTERFACES(x)
    180181#define Q_PROPERTY(text) Q_PROPERTY(text)
     182
    181183#define Q_OVERRIDE(text) Q_OVERRIDE(text)
    182184#define Q_ENUMS(x) Q_ENUMS(x)
  • trunk/src/corelib/kernel/qtranslator.cpp

    r651 r769  
    634634    if (!tn)
    635635        return QString();
    636     QString str = QString::fromUtf16((const ushort *)tn, tn_length/2);
     636    QString str = QString *)tn, tn_length/2);
    637637    if (QSysInfo::ByteOrder == QSysInfo::LittleEndian) {
    638638        for (int i = 0; i < str.length(); ++i)
  • trunk/src/corelib/kernel/qvariant.cpp

    r651 r769  
    467467     * user defined pointer types. */
    468468    const char *const typeName = QMetaType::typeName(a->type);
    469     if (typeName[qstrlen(typeName) - 1] == '*')
     469    uint typeNameLen = qstrlen(typeName);
     470    if (typeNameLen > 0 && typeName[typeNameLen - 1] == '*')
    470471        return *static_cast<void *const *>(a_ptr) == *static_cast<void *const *>(b_ptr);
     472
     473
     474
    471475
    472476    return a_ptr == b_ptr;
Note: See TracChangeset for help on using the changeset viewer.