Skip to content

Commit 18455f9

Browse files
committed
Avoid disposing current unique window
Add a check to ensure windows[unique] != window before calling toFront() and disposing, preventing the code from disposing the active window. Also tidy imports: replace layout wildcard with explicit Box/fillMaxSize/fillMaxWidth/fillMaxHeight imports, consolidate androidx.compose.runtime imports, and remove unused imports. Fixes #1471
1 parent 4206874 commit 18455f9

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

app/src/processing/app/ui/theme/Window.kt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
package processing.app.ui.theme
22

33
import androidx.compose.foundation.background
4-
import androidx.compose.foundation.layout.*
4+
import androidx.compose.foundation.layout.Box
5+
import androidx.compose.foundation.layout.fillMaxHeight
6+
import androidx.compose.foundation.layout.fillMaxSize
7+
import androidx.compose.foundation.layout.fillMaxWidth
58
import androidx.compose.material3.Text
6-
import androidx.compose.runtime.Composable
7-
import androidx.compose.runtime.CompositionLocalProvider
8-
import androidx.compose.runtime.DisposableEffect
9-
import androidx.compose.runtime.compositionLocalOf
10-
import androidx.compose.runtime.remember
9+
import androidx.compose.runtime.*
1110
import androidx.compose.ui.Alignment
1211
import androidx.compose.ui.Modifier
1312
import androidx.compose.ui.awt.ComposeWindow
@@ -21,9 +20,7 @@ import androidx.compose.ui.window.rememberWindowState
2120
import com.formdev.flatlaf.util.SystemInfo
2221
import processing.app.ui.Toolkit
2322
import java.awt.Dimension
24-
2523
import javax.swing.JFrame
26-
import javax.swing.JRootPane
2724
import kotlin.reflect.KClass
2825

2926
val LocalWindow = compositionLocalOf<JFrame> { error("No Window Set") }
@@ -120,7 +117,7 @@ private fun PDEWindowContent(
120117
window.rootPane.putClientProperty("apple.awt.transparentTitleBar", mac && fullWindowContent)
121118
Toolkit.setIcon(window)
122119
}
123-
if(unique != null && windows.contains(unique) && windows[unique] != null){
120+
if (unique != null && windows.contains(unique) && windows[unique] != null && windows[unique] != window) {
124121
windows[unique]?.toFront()
125122
window.dispose()
126123
return

0 commit comments

Comments
 (0)