Skip to content

Commit 1f4a24c

Browse files
authored
Merge pull request #325 from imagej/fix-tests
Fix napari-imagej tests
2 parents 3862a41 + 7b8d8d1 commit 1f4a24c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/napari_imagej/widgets/napari_imagej.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,15 @@ def return_search_bar():
138138
# Start constructing the ImageJ instance
139139
self.ij_initializer.start()
140140

141+
# Ensure widget closes when JVM closes
142+
# Without this call we are prone to segfaults during JVM shutdown
143+
when_jvm_stops(self.close)
144+
141145
def close(self):
146+
# Ensure setup completed
147+
self.wait_for_finalization()
148+
# Close things down
149+
super().close()
142150
self.ij_initializer._clean_subscribers()
143151

144152
def wait_for_finalization(self):

0 commit comments

Comments
 (0)