Przeglądaj źródła

FIX: Bug [0002079] Closing takes a long time (crashes on exit)

Alexander Koblov 7 lat temu
rodzic
commit
8d0f21c3f4
2 zmienionych plików z 32 dodań i 0 usunięć
  1. 3 0
      src/doublecmd.lpr
  2. 29 0
      src/platform/unix/uqt5workaround.pas

+ 3 - 0
src/doublecmd.lpr

@@ -22,6 +22,9 @@ uses
   gtk2,
   Gtk2Int,
   {$ENDIF}
+  {$IF DEFINED(LCLQT5) and not DEFINED(DARWIN)}
+  uQt5Workaround,
+  {$ENDIF}
   {$ENDIF}
   DCConvertEncoding,
   Interfaces,

+ 29 - 0
src/platform/unix/uqt5workaround.pas

@@ -0,0 +1,29 @@
+unit uQt5Workaround;
+
+{$mode objfpc}{$H+}
+
+interface
+
+implementation
+
+uses
+  InitC, CTypes, BaseUnix;
+
+procedure _exit(status: cint); cdecl; external clib;
+function atexit(func: pointer): cint; cdecl; external clib;
+
+procedure DoExit; cdecl;
+begin
+  _exit(ExitCode);
+end;
+
+finalization
+  // Workaround: https://doublecmd.sourceforge.io/mantisbt/view.php?id=2079
+  if (UpCase(fpGetEnv(PAnsiChar('XDG_CURRENT_DESKTOP'))) = 'KDE') then
+  begin
+    atexit(@DoExit);
+    WriteLn('Warning: Skip libKF5IconThemes exit handler');
+  end;
+
+end.
+