Changeset View
Changeset View
Standalone View
Standalone View
src/kcrash.cpp
Show First 20 Lines • Show All 254 Lines • ▼ Show 20 Line(s) | |||||
255 | 255 | | |||
256 | bool KCrash::isDrKonqiEnabled() | 256 | bool KCrash::isDrKonqiEnabled() | ||
257 | { | 257 | { | ||
258 | return s_launchDrKonqi == 1; | 258 | return s_launchDrKonqi == 1; | ||
259 | } | 259 | } | ||
260 | 260 | | |||
261 | // The following functions copy&pasted from kinit/wrapper.cpp : | 261 | // The following functions copy&pasted from kinit/wrapper.cpp : | ||
262 | // (which copied it from kdeinit/kinit.cpp) | 262 | // (which copied it from kdeinit/kinit.cpp) | ||
263 | // Can't use QGuiApplication::platformName() here, there is no app instance. | ||||
264 | #if HAVE_X11 || HAVE_XCB | ||||
263 | static const char* displayEnvVarName_c() | 265 | static const char* displayEnvVarName_c() | ||
264 | { | 266 | { | ||
265 | // Can't use QGuiApplication::platformName() here, there is no app instance. | | |||
266 | #if HAVE_X11 | | |||
267 | return "DISPLAY"; | 267 | return "DISPLAY"; | ||
268 | #elif defined(Q_OS_OSX) | | |||
269 | return "MAC_DISPLAY"; | | |||
270 | #elif defined(Q_OS_WIN) | | |||
271 | return "WIN_DISPLAY"; | | |||
272 | #endif | | |||
273 | } | 268 | } | ||
bshah: That sounds wrong.. possibly you have to check if HAVE_WAYLAND is true.. | |||||
dfaure: I wonder why this isn't removed then, it can't happen ;-) | |||||
vkrause: Indeed, I'll clean it up here and in kinit. | |||||
269 | #endif | ||||
274 | 270 | | |||
275 | // adapted from kdeinit/kinit.cpp | 271 | // adapted from kdeinit/kinit.cpp | ||
276 | // WARNING, if you change the socket name, adjust kinit.cpp too | 272 | // WARNING, if you change the socket name, adjust kinit.cpp too | ||
277 | static const QString generate_socket_file_name() | 273 | static const QString generate_socket_file_name() | ||
278 | { | 274 | { | ||
279 | 275 | | |||
276 | #if HAVE_X11 || HAVE_XCB | ||||
280 | QByteArray display = qgetenv(displayEnvVarName_c()); | 277 | QByteArray display = qgetenv(displayEnvVarName_c()); | ||
281 | if (display.isEmpty()) { | 278 | if (display.isEmpty()) { | ||
282 | #if HAVE_X11 | | |||
283 | fprintf(stderr, "Error: could not determine $%s.\n", displayEnvVarName_c()); | 279 | fprintf(stderr, "Error: could not determine $%s.\n", displayEnvVarName_c()); | ||
284 | return QString(); | 280 | return QString(); | ||
285 | } else { | 281 | } | ||
286 | #endif | | |||
287 | int i; | 282 | int i; | ||
288 | if ((i = display.lastIndexOf('.')) > display.lastIndexOf(':') && i >= 0) { | 283 | if ((i = display.lastIndexOf('.')) > display.lastIndexOf(':') && i >= 0) { | ||
289 | display.truncate(i); | 284 | display.truncate(i); | ||
290 | } | 285 | } | ||
291 | 286 | | |||
292 | display.replace(':', '_'); | 287 | display.replace(':', '_'); | ||
293 | #ifdef __APPLE__ | 288 | #ifdef __APPLE__ | ||
294 | display.replace('/', '_'); | 289 | display.replace('/', '_'); | ||
295 | #endif | 290 | #endif | ||
296 | } | 291 | #else | ||
292 | // not using a DISPLAY variable; use an empty string instead | ||||
293 | QByteArray display = ""; | ||||
294 | #endif | ||||
297 | const QString socketFileName = QString::fromLatin1("kdeinit5_%1").arg(QLatin1String(display)); | 295 | const QString socketFileName = QString::fromLatin1("kdeinit5_%1").arg(QLatin1String(display)); | ||
298 | return socketFileName; | 296 | return socketFileName; | ||
299 | } | 297 | } | ||
300 | 298 | | |||
301 | void | 299 | void | ||
302 | KCrash::setCrashHandler(HandlerType handler) | 300 | KCrash::setCrashHandler(HandlerType handler) | ||
303 | { | 301 | { | ||
304 | if (!s_kdeinit_socket_file) { | 302 | if (!s_kdeinit_socket_file) { | ||
▲ Show 20 Lines • Show All 529 Lines • Show Last 20 Lines |
That sounds wrong.. possibly you have to check if HAVE_WAYLAND is true..