88#include < sys/stat.h>
99#include < clocale>
1010#include < cstdio>
11- #include < cstdlib>
1211#include < exception>
1312#include < filesystem>
1413#include < iostream>
1514#include < string>
16- #include < utility>
1715#include < vector>
1816#include " fcitx-utils/environ.h"
19- #include " fcitx-utils/fs.h"
2017#include " fcitx-utils/log.h"
2118#include " fcitx-utils/misc.h"
2219#include " fcitx-utils/misc_p.h"
2320#include " fcitx-utils/standardpath.h"
2421#include " fcitx-utils/standardpaths.h"
25- #include " fcitx-utils/stringutils.h"
2622#include " fcitx/addonfactory.h"
2723#include " fcitx/addoninstance.h"
2824#include " fcitx/addonloader.h"
3127#include " errorhandler.h"
3228
3329using namespace fcitx ;
34- int selfpipe[2 ];
35- std::filesystem::path crashlog;
3630
3731FCITX_DEFINE_STATIC_ADDON_REGISTRY (getStaticAddon)
3832#ifdef ENABLE_KEYBOARD
@@ -43,7 +37,8 @@ int main(int argc, char *argv[]) {
4337 umask (077 );
4438 StandardPath::global ().syncUmask ();
4539 StandardPaths::global ().syncUmask ();
46- if (safePipe (selfpipe) < 0 ) {
40+ int selfPipe[2 ];
41+ if (safePipe (selfPipe) < 0 ) {
4742 fprintf (stderr, " Could not create self-pipe.\n " );
4843 return 1 ;
4944 }
@@ -54,15 +49,7 @@ int main(int argc, char *argv[]) {
5449 return 1 ;
5550 }
5651
57- auto userDir =
58- StandardPaths::global ().userDirectory (StandardPathsType::PkgConfig);
59- if (!userDir.empty ()) {
60- if (fs::makePath (userDir)) {
61- crashlog = userDir / " crash.log" ;
62- }
63- }
64-
65- SetMyExceptionHandler ();
52+ SetMyExceptionHandler (selfPipe[1 ]);
6653
6754 setlocale (LC_ALL, " " );
6855
@@ -74,7 +61,7 @@ int main(int argc, char *argv[]) {
7461 FCITX_LOG_IF (Info, isInFlatpak ()) << " Running inside flatpak." ;
7562 Instance instance (argc, argv);
7663 instance.setBinaryMode ();
77- instance.setSignalPipe (selfpipe [0 ]);
64+ instance.setSignalPipe (selfPipe [0 ]);
7865 instance.addonManager ().registerDefaultLoader (&getStaticAddon ());
7966
8067 ret = instance.exec ();
0 commit comments