Changeset 871


Ignore:
Timestamp:
Jun 9, 2011, 8:17:01 PM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

gui: Fixed application crashes if the xsystray API DLL could not be loaded.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/util/qsystemtrayicon_pm.cpp

    r856 r871  
    246246}
    247247
     248
     249
     250
     251
     252
     253
     254
     255
     256
     257
     258
     259
     260
     261
     262
     263
     264
     265
     266
     267
     268
     269
     270
     271
     272
     273
     274
     275
     276
     277
     278
     279
     280
     281
     282
     283
     284
     285
     286
     287
     288
     289
     290
    248291void QSystemTrayIconPrivate::install_sys()
    249292{
     293
     294
     295
    250296    Q_Q(QSystemTrayIcon);
    251297    if (!sys) {
     
    308354}
    309355
    310 template <typename T>
    311 inline T AssignFromVoidPtr(T &var, void *val) { var = (T)val; return var; }
    312 
    313356bool QSystemTrayIconPrivate::isSystemTrayAvailable_sys()
    314357{
    315     static bool tried = false;
    316     if (!tried) {
    317         tried = true;
    318 
    319         // link to the xsystray DLL at runtime
    320         QLibrary xsystray(QLatin1String("xsystray"));
    321 
    322         #define R(f) if (AssignFromVoidPtr(f, xsystray.resolve(#f)) == NULL) return false
    323 
    324         R(xstQuerySysTrayVersion);
    325         R(xstAddSysTrayIcon);
    326         R(xstReplaceSysTrayIcon);
    327         R(xstRemoveSysTrayIcon);
    328         R(xstSetSysTrayIconToolTip);
    329         R(xstQuerySysTrayIconRect);
    330         R(xstShowSysTrayIconBalloon);
    331         R(xstHideSysTrayIconBalloon);
    332         R(xstGetSysTrayCreatedMsgId);
    333         R(xstGetSysTrayMaxTextLen);
    334 
    335         #undef R
    336 
    337         // initialize some constants
    338         WM_XST_CREATED = xstGetSysTrayCreatedMsgId();
    339         MaxTextLen = xstGetSysTrayMaxTextLen();
    340     }
    341 
     358    if (!gotApis && !resolveApis())
     359        return false;
    342360    return xstQuerySysTrayVersion(0, 0, 0);
    343361}
Note: See TracChangeset for help on using the changeset viewer.