File tree Expand file tree Collapse file tree 4 files changed +17
-4
lines changed
common/src/main/kotlin/br/com/firstsoft/core/common/reporting
native/src/main/kotlin/br/com/firstsoft/core/os/hwinfo
target/server/src/main/kotlin/br/com/firstsoft/target/server Expand file tree Collapse file tree 4 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -2,11 +2,15 @@ package br.com.firstsoft.core.common.reporting
2
2
3
3
import java.io.File
4
4
5
+ fun logException (throwable : Throwable ) {
6
+ File (" cleanmeter.error.${System .currentTimeMillis()} .log" ).printWriter()
7
+ .use { it.print (throwable.stackTraceToString()) }
8
+ }
9
+
5
10
fun setDefaultUncaughtExceptionHandler () {
6
11
Thread .setDefaultUncaughtExceptionHandler { thread, throwable ->
7
12
try {
8
- File (" cleanmeter.error.${System .currentTimeMillis()} .log" ).printWriter()
9
- .use { it.print (throwable.stackTraceToString()) }
13
+ logException(throwable)
10
14
} catch (e: Exception ) {
11
15
e.printStackTrace()
12
16
}
Original file line number Diff line number Diff line change @@ -33,7 +33,11 @@ object HwInfoProcessManager {
33
33
}
34
34
35
35
fun stop () {
36
- process?.destroy()
36
+ process?.apply {
37
+ descendants().forEach(ProcessHandle ::destroy)
38
+ destroy()
39
+ }
40
+ process = null
37
41
}
38
42
39
43
private fun overwriteSettings () {
Original file line number Diff line number Diff line change @@ -46,7 +46,10 @@ fun main() {
46
46
onOverlaySettings = {
47
47
overlaySettings = it
48
48
},
49
- getOverlayPosition = { overlayPosition }
49
+ getOverlayPosition = { overlayPosition },
50
+ onApplicationExit = {
51
+ HwInfoProcessManager .stop()
52
+ }
50
53
)
51
54
}
52
55
}
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ fun ApplicationScope.SettingsWindow(
23
23
overlaySettings : OverlaySettings ,
24
24
onOverlaySettings : (OverlaySettings ) -> Unit ,
25
25
getOverlayPosition : () -> IntOffset ,
26
+ onApplicationExit : () -> Unit ,
26
27
) {
27
28
var isVisible by remember {
28
29
mutableStateOf(
@@ -65,6 +66,7 @@ fun ApplicationScope.SettingsWindow(
65
66
GlobalScreen .unregisterNativeHook()
66
67
} catch (e: Exception ) {
67
68
}
69
+ onApplicationExit()
68
70
exitApplication()
69
71
})
70
72
}
You can’t perform that action at this time.
0 commit comments