-rw-r--r-- | qmake/tools/qcomlibrary.cpp | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/qmake/tools/qcomlibrary.cpp b/qmake/tools/qcomlibrary.cpp index a7162fc..2a1b75a 100644 --- a/qmake/tools/qcomlibrary.cpp +++ b/qmake/tools/qcomlibrary.cpp | |||
@@ -54,24 +54,28 @@ | |||
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | 56 | ||
57 | QComLibrary::QComLibrary( const QString &filename ) | 57 | QComLibrary::QComLibrary( const QString &filename ) |
58 | : QLibrary( filename ), entry( 0 ), libiface( 0 ), qt_version( 0 ) | 58 | : QLibrary( filename ), entry( 0 ), libiface( 0 ), qt_version( 0 ) |
59 | { | 59 | { |
60 | } | 60 | } |
61 | 61 | ||
62 | QComLibrary::~QComLibrary() | 62 | QComLibrary::~QComLibrary() |
63 | { | 63 | { |
64 | if ( autoUnload() ) | 64 | if ( autoUnload() ) |
65 | unload(); | 65 | unload(); |
66 | if ( libiface ) | ||
67 | libiface->release(); | ||
68 | if ( entry ) | ||
69 | entry->release(); | ||
66 | } | 70 | } |
67 | 71 | ||
68 | bool QComLibrary::unload() | 72 | bool QComLibrary::unload() |
69 | { | 73 | { |
70 | if ( libiface ) { | 74 | if ( libiface ) { |
71 | libiface->cleanup(); | 75 | libiface->cleanup(); |
72 | if ( !libiface->canUnload() ) | 76 | if ( !libiface->canUnload() ) |
73 | return FALSE; | 77 | return FALSE; |
74 | libiface->release(); | 78 | libiface->release(); |
75 | libiface = 0; | 79 | libiface = 0; |
76 | } | 80 | } |
77 | int refs = entry ? entry->release() : 0; | 81 | int refs = entry ? entry->release() : 0; |
@@ -382,47 +386,45 @@ void QComLibrary::createInstanceInternal() | |||
382 | QFileInfo fileinfo( library() ); | 386 | QFileInfo fileinfo( library() ); |
383 | QString lastModified = fileinfo.lastModified().toString(); | 387 | QString lastModified = fileinfo.lastModified().toString(); |
384 | QString regkey = QString("/Qt Plugins %1.%2/%3") | 388 | QString regkey = QString("/Qt Plugins %1.%2/%3") |
385 | .arg( ( QT_VERSION & 0xff0000 ) >> 16 ) | 389 | .arg( ( QT_VERSION & 0xff0000 ) >> 16 ) |
386 | .arg( ( QT_VERSION & 0xff00 ) >> 8 ) | 390 | .arg( ( QT_VERSION & 0xff00 ) >> 8 ) |
387 | .arg( library() ); | 391 | .arg( library() ); |
388 | QStringList reg; | 392 | QStringList reg; |
389 | uint flags = 0; | 393 | uint flags = 0; |
390 | QCString key; | 394 | QCString key; |
391 | bool query_done = FALSE; | 395 | bool query_done = FALSE; |
392 | bool warn_mismatch = TRUE; | 396 | bool warn_mismatch = TRUE; |
393 | 397 | ||
394 | if ( ! query_done ) { | ||
395 | |||
396 | #ifdef QT_THREAD_SUPPORT | 398 | #ifdef QT_THREAD_SUPPORT |
397 | QMutexLocker locker( qt_global_mutexpool->get( &cache ) ); | 399 | QMutexLocker locker( qt_global_mutexpool ? |
400 | qt_global_mutexpool->get( &cache ) : 0 ); | ||
398 | #endif // QT_THREAD_SUPPORT | 401 | #endif // QT_THREAD_SUPPORT |
399 | 402 | ||
400 | if ( ! cache ) { | 403 | if ( ! cache ) { |
401 | cache = new QSettings; | 404 | cache = new QSettings; |
402 | cache->insertSearchPath( QSettings::Windows, "/Trolltech" ); | 405 | cache->insertSearchPath( QSettings::Windows, "/Trolltech" ); |
403 | cleanup_cache.set( &cache ); | 406 | cleanup_cache.set( &cache ); |
404 | } | 407 | } |
405 | 408 | ||
406 | reg = cache->readListEntry( regkey ); | 409 | reg = cache->readListEntry( regkey ); |
407 | if ( reg.count() == 4 ) { | 410 | if ( reg.count() == 4 ) { |
408 | // check timestamp | 411 | // check timestamp |
409 | if ( lastModified == reg[3] ) { | 412 | if ( lastModified == reg[3] ) { |
410 | qt_version = reg[0].toUInt(0, 16); | 413 | qt_version = reg[0].toUInt(0, 16); |
411 | flags = reg[1].toUInt(0, 16); | 414 | flags = reg[1].toUInt(0, 16); |
412 | key = reg[2].latin1(); | 415 | key = reg[2].latin1(); |
413 | 416 | ||
414 | query_done = TRUE; | 417 | query_done = TRUE; |
415 | warn_mismatch = FALSE; | 418 | warn_mismatch = FALSE; |
416 | } | ||
417 | } | 419 | } |
418 | } | 420 | } |
419 | 421 | ||
420 | #if defined(Q_OS_UNIX) | 422 | #if defined(Q_OS_UNIX) |
421 | if ( ! query_done ) { | 423 | if ( ! query_done ) { |
422 | // get the query information directly from the plugin without loading | 424 | // get the query information directly from the plugin without loading |
423 | if ( qt_unix_query( library(), &qt_version, &flags, &key ) ) { | 425 | if ( qt_unix_query( library(), &qt_version, &flags, &key ) ) { |
424 | // info read succesfully from library | 426 | // info read succesfully from library |
425 | query_done = TRUE; | 427 | query_done = TRUE; |
426 | } | 428 | } |
427 | } | 429 | } |
428 | #else // !Q_OS_UNIX | 430 | #else // !Q_OS_UNIX |
@@ -452,29 +454,24 @@ void QComLibrary::createInstanceInternal() | |||
452 | query_done = TRUE; | 454 | query_done = TRUE; |
453 | } | 455 | } |
454 | } | 456 | } |
455 | #endif // Q_OS_UNIX | 457 | #endif // Q_OS_UNIX |
456 | 458 | ||
457 | QStringList queried; | 459 | QStringList queried; |
458 | queried << QString::number( qt_version,16 ) | 460 | queried << QString::number( qt_version,16 ) |
459 | << QString::number( flags, 16 ) | 461 | << QString::number( flags, 16 ) |
460 | << key | 462 | << key |
461 | << lastModified; | 463 | << lastModified; |
462 | 464 | ||
463 | if ( queried != reg ) { | 465 | if ( queried != reg ) { |
464 | |||
465 | #ifdef QT_THREAD_SUPPORT | ||
466 | QMutexLocker locker( qt_global_mutexpool->get( &cache ) ); | ||
467 | #endif // QT_THREAD_SUPPORT | ||
468 | |||
469 | cache->writeEntry( regkey, queried ); | 466 | cache->writeEntry( regkey, queried ); |
470 | // delete the cache, which forces the settings to be written | 467 | // delete the cache, which forces the settings to be written |
471 | delete cache; | 468 | delete cache; |
472 | cache = 0; | 469 | cache = 0; |
473 | } | 470 | } |
474 | 471 | ||
475 | if ( ! query_done ) { | 472 | if ( ! query_done ) { |
476 | if ( warn_mismatch ) { | 473 | if ( warn_mismatch ) { |
477 | qWarning( "Conflict in %s:\n Plugin cannot be queried successfully!", | 474 | qWarning( "Conflict in %s:\n Plugin cannot be queried successfully!", |
478 | (const char*) QFile::encodeName( library() ) ); | 475 | (const char*) QFile::encodeName( library() ) ); |
479 | } | 476 | } |
480 | unload(); | 477 | unload(); |