Repository navigation
fix: prevent X11 IO error crash on mode switch #1755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,11 +14,13 @@ | |
| #include <QQuickWindow> | ||
| #include <QWindow> | ||
|
|
||
| #include <csignal> | ||
| #include <iostream> | ||
| #include <X11/Xlib.h> | ||
| #include <unistd.h> | ||
|
|
||
| #include "applet.h" | ||
| #include "containment.h" | ||
| #include "pluginloader.h" | ||
| #include "appletconfigmanager.h" | ||
| #include "appletloader.h" | ||
|
|
@@ -134,6 +136,11 @@ | |
| QList<DAppletLoader *> m_loaders; | ||
| }; | ||
|
|
||
| static int x11IOErrorHandler(Display *) | ||
| { | ||
| _exit(0); | ||
| } | ||
|
|
||
| int main(int argc, char *argv[]) | ||
| { | ||
| setenv("DSG_APP_ID", "org.deepin.dde.shell", 0); | ||
|
|
@@ -255,6 +262,8 @@ | |
| manager.exec(); | ||
| }, Qt::QueuedConnection); | ||
|
|
||
| XSetIOErrorHandler(x11IOErrorHandler); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Medium · Startup X11 errors still trigger destructor crashes When the X server connection fails during application or shell startup, before Install the I/O error handler before any startup code can use the X11 connection. Prompt for AI agentsIn `shell/main.cpp` at line 265:
**Startup X11 errors still trigger destructor crashes**
When the X server connection fails during application or shell startup, before `XSetIOErrorHandler` is called, the default libX11 handler remains active while the application and applet setup run; it calls `exit()` on an I/O error, running destructors against the dead display and potentially crashing dde-shell.
Install the I/O error handler before any startup code can use the X11 connection. |
||
|
|
||
| QObject::connect(qApp, &QCoreApplication::aboutToQuit, qApp, [&manager]() { | ||
| qCInfo(dsLog) << "Exit dde-shell."; | ||
| DPluginLoader::instance()->destroy(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Medium · Wayland-only builds still require X11
When
BUILD_WITH_X11is disabled and X11 development files are unavailable, the unconditionalpkg_check_modules(X11 REQUIRED ...)lookup fails during CMake configuration, and the unconditional Xlib include inmain.cppalso prevents a build without X11. The Wayland-only build cannot complete.Gate the X11 pkg-config lookup and Xlib include on
BUILD_WITH_X11.Also at
shell/main.cpp:19-20,shell/main.cpp:265,shell/CMakeLists.txt:52.Prompt for AI agents