From: Vadim Zeitlin Date: Thu, 3 May 2007 13:41:36 +0000 (+0000) Subject: show the error returned by SmcOpenConnection(); don't call it more than once -- the... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/dee28fdd4dda8fc428aec093b9633f52d5144540 show the error returned by SmcOpenConnection(); don't call it more than once -- the desktop environment is not going to change while the program is running git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45785 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/gtk/utilsgtk.cpp b/src/gtk/utilsgtk.cpp index 13bc7c448c..faf8184ba8 100644 --- a/src/gtk/utilsgtk.cpp +++ b/src/gtk/utilsgtk.cpp @@ -332,15 +332,19 @@ static wxString GetSM() if ( !dpy ) return wxEmptyString; + char smerr[256]; char *client_id; SmcConn smc_conn = SmcOpenConnection(NULL, NULL, 999, 999, 0 /* mask */, NULL /* callbacks */, NULL, &client_id, - 0, NULL); + WXSIZEOF(smerr), smerr); if ( !smc_conn ) + { + wxLogWarning(_("Failed to connect to session manager: %s"), smerr); return wxEmptyString; + } char *vendor = SmcVendor(smc_conn); wxString ret = wxString::FromAscii( vendor ); @@ -471,7 +475,7 @@ bool wxGUIAppTraits::ShowAssertDialog(const wxString& msg) wxString wxGUIAppTraits::GetDesktopEnvironment() const { #if wxUSE_DETECT_SM - const wxString SM = GetSM(); + static const wxString SM = GetSM(); if (SM == wxT("GnomeSM")) return wxT("GNOME");