diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-06-15 08:58:57 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-06-16 09:39:52 (GMT) |
commit | 840cc3614bb365c018951f5b4211030fc303bcc8 (patch) | |
tree | ff8cace3f9988fa1864df9c4f42e3657d56184f2 /src/gui | |
parent | 94e39aff7dd02d4a631d5c40c6f5a5f6fa424035 (diff) | |
download | Qt-840cc3614bb365c018951f5b4211030fc303bcc8.zip Qt-840cc3614bb365c018951f5b4211030fc303bcc8.tar.gz Qt-840cc3614bb365c018951f5b4211030fc303bcc8.tar.bz2 |
Fix for resetting DESKTOP_STARTUP_ID envvar.
That was wrong to reset environment variable returned with a putenv
since getenv returns a value only. This fix reverts to old behavior
when unsetenv is not available and will leak 20 bytes once on
qapplication initialization.
This fixes 2f4ca8e06be0477503acf2a4bf38a1c76f52e5b1.
Reviewed-by: Bradley T. Hughes
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qapplication_x11.cpp | 17 | ||||
-rw-r--r-- | src/gui/kernel/qt_x11_p.h | 2 |
2 files changed, 3 insertions, 16 deletions
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 7387fb0..8526760 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -128,7 +128,7 @@ extern "C" { #include <private/qbackingstore_p.h> -#if defined(Q_OS_BSD4) || _POSIX_VERSION+0 < 200112L +#if _POSIX_VERSION+0 < 200112L && !defined(Q_OS_BSD4) # define QT_NO_UNSETENV #endif @@ -1761,7 +1761,7 @@ void qt_init(QApplicationPrivate *priv, int, X11->pattern_fills[i].screen = -1; #endif - X11->startupId = X11->originalStartupId = X11->startupIdString = 0; + X11->startupId = 0; int argc = priv->argc; char **argv = priv->argv; @@ -2559,15 +2559,13 @@ void qt_init(QApplicationPrivate *priv, int, #endif // QT_NO_TABLET X11->startupId = getenv("DESKTOP_STARTUP_ID"); - X11->originalStartupId = X11->startupId; if (X11->startupId) { #ifndef QT_NO_UNSETENV unsetenv("DESKTOP_STARTUP_ID"); #else // it's a small memory leak, however we won't crash if Qt is // unloaded and someones tries to use the envoriment. - X11->startupIdString = strdup("DESKTOP_STARTUP_ID="); - putenv(X11->startupIdString); + putenv(strdup("DESKTOP_STARTUP_ID=")); #endif } } else { @@ -2701,15 +2699,6 @@ void qt_cleanup() #endif } -#ifdef QT_NO_UNSETENV - // restore original value back. - if (X11->originalStartupId && X11->startupIdString) { - putenv(X11->originalStartupId); - free(X11->startupIdString); - X11->startupIdString = 0; - } -#endif - #ifndef QT_NO_XRENDER for (int i = 0; i < X11->solid_fill_count; ++i) { if (X11->solid_fills[i].picture) diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h index b480f34..3493a8b 100644 --- a/src/gui/kernel/qt_x11_p.h +++ b/src/gui/kernel/qt_x11_p.h @@ -506,8 +506,6 @@ struct QX11Data int fc_hint_style; char *startupId; - char *originalStartupId; - char *startupIdString; DesktopEnvironment desktopEnvironment; |