diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2011-10-07 12:45:40 (GMT) |
---|---|---|
committer | Jan-Arve Saether <jan-arve.saether@nokia.com> | 2011-10-07 12:45:40 (GMT) |
commit | a0feeef52efde872c6d6e458c8e15616da0bf74f (patch) | |
tree | 8c846d041bbce0ac4f10eac1b1b93250144f7f60 /src/gui/kernel | |
parent | 74251fb0fc57b1e0f7db0b561e4aa4c0347f6f37 (diff) | |
download | Qt-a0feeef52efde872c6d6e458c8e15616da0bf74f.zip Qt-a0feeef52efde872c6d6e458c8e15616da0bf74f.tar.gz Qt-a0feeef52efde872c6d6e458c8e15616da0bf74f.tar.bz2 |
fix possible race conditions
the initialization guard must be set after the initialization is done;
for the code assumed to be only executed in a single thread, this change was done
just for consistency - in order to avoid similar issues by copy-pasting in future
Merge-request: 2655
Reviewed-by: Jan-Arve Saether <jan-arve.saether@nokia.com>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qapplication_win.cpp | 12 | ||||
-rw-r--r-- | src/gui/kernel/qguifunctions_wince.cpp | 5 | ||||
-rw-r--r-- | src/gui/kernel/qmime_mac.cpp | 4 |
3 files changed, 11 insertions, 10 deletions
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index bca3acc..b84fe56 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -218,9 +218,9 @@ static bool aygResolved = false; static void resolveAygLibs() { if (!aygResolved) { - aygResolved = true; QSystemLibrary ayglib(QLatin1String("aygshell")); ptrRecognizeGesture = (AygRecognizeGesture) ayglib.resolve("SHRecognizeGesture"); + aygResolved = true; } } #endif // QT_NO_GESTURES @@ -2371,15 +2371,14 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa break; } +#if !defined(Q_OS_WINCE) typedef LRESULT (WINAPI *PtrLresultFromObject)(REFIID, WPARAM, LPUNKNOWN); static PtrLresultFromObject ptrLresultFromObject = 0; static bool oleaccChecked = false; - if (!oleaccChecked) { + QSystemLibrary oleacclib(QLatin1String("oleacc")); + ptrLresultFromObject = (PtrLresultFromObject)oleacclib.resolve("LresultFromObject"); oleaccChecked = true; -#if !defined(Q_OS_WINCE) - ptrLresultFromObject = (PtrLresultFromObject)QSystemLibrary::resolve(QLatin1String("oleacc"), "LresultFromObject"); -#endif } if (ptrLresultFromObject) { QAccessibleInterface *acc = QAccessible::queryAccessibleInterface(widget); @@ -2396,6 +2395,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa if (res > 0) RETURN(res); } +#endif } result = false; break; @@ -3181,8 +3181,8 @@ bool QETWidget::translateMouseEvent(const MSG &msg) if (curWin != 0) { if (!trackMouseEventLookup) { - trackMouseEventLookup = true; ptrTrackMouseEvent = (PtrTrackMouseEvent)QSystemLibrary::resolve(QLatin1String("comctl32"), "_TrackMouseEvent"); + trackMouseEventLookup = true; } if (ptrTrackMouseEvent && !qApp->d_func()->inPopupMode()) { // We always have to set the tracking, since diff --git a/src/gui/kernel/qguifunctions_wince.cpp b/src/gui/kernel/qguifunctions_wince.cpp index 78dc469..ae2ca04 100644 --- a/src/gui/kernel/qguifunctions_wince.cpp +++ b/src/gui/kernel/qguifunctions_wince.cpp @@ -125,17 +125,16 @@ static AygInitDialog ptrAygInitDialog = 0; static AygFullScreen ptrAygFullScreen = 0; static AygSHSipInfo ptrAygSHSipInfo = 0; static AygSHDoneButton ptrAygSHDoneButton = 0; -static bool aygResolved = false; - static void resolveAygLibs() { + static bool aygResolved = false; if (!aygResolved) { - aygResolved = true; QLibrary ayglib(QLatin1String("aygshell")); ptrAygInitDialog = (AygInitDialog) ayglib.resolve("SHInitDialog"); ptrAygFullScreen = (AygFullScreen) ayglib.resolve("SHFullScreen"); ptrAygSHSipInfo = (AygSHSipInfo) ayglib.resolve("SHSipInfo"); ptrAygSHDoneButton = (AygSHDoneButton) ayglib.resolve("SHDoneButton"); + aygResolved = true; } } diff --git a/src/gui/kernel/qmime_mac.cpp b/src/gui/kernel/qmime_mac.cpp index 8b47d8e..e92bd49 100644 --- a/src/gui/kernel/qmime_mac.cpp +++ b/src/gui/kernel/qmime_mac.cpp @@ -520,13 +520,15 @@ static PtrGraphicsExportDoExport ptrGraphicsExportDoExport = 0; static bool resolveMimeQuickTimeSymbols() { - if (ptrGraphicsImportSetDataHandle == 0) { + static bool triedResolve = false; + if (!triedResolve) { QLibrary library(QLatin1String("/System/Library/Frameworks/QuickTime.framework/QuickTime")); ptrGraphicsImportSetDataHandle = reinterpret_cast<PtrGraphicsImportSetDataHandle>(library.resolve("GraphicsImportSetDataHandle")); ptrGraphicsImportCreateCGImage = reinterpret_cast<PtrGraphicsImportCreateCGImage>(library.resolve("GraphicsImportCreateCGImage")); ptrGraphicsExportSetInputCGImage = reinterpret_cast<PtrGraphicsExportSetInputCGImage>(library.resolve("GraphicsExportSetInputCGImage")); ptrGraphicsExportSetOutputHandle = reinterpret_cast<PtrGraphicsExportSetOutputHandle>(library.resolve("GraphicsExportSetOutputHandle")); ptrGraphicsExportDoExport = reinterpret_cast<PtrGraphicsExportDoExport>(library.resolve("GraphicsExportDoExport")); + triedResolve = true; } return ptrGraphicsImportSetDataHandle != 0 |