File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,7 @@ This means that druid no longer requires cairo on macOS and uses Core Graphics i
145145- Added docs generation testing for all features. ([ #942 ] by [ @xStrom ] )
146146- Renamed ` BaseState ` to ` WidgetState ` ([ #969 ] by [ @cmyr ] )
147147- X11: Reworked error handling ([ #982 ] by [ @jneem ] )
148+ - Fixed test harness crashing on failure. ([ #984 ] by [ @xStrom ] )
148149
149150### Outside News
150151
@@ -231,6 +232,7 @@ This means that druid no longer requires cairo on macOS and uses Core Graphics i
231232[ #970 ] : https://github.com/xi-editor/druid/pull/970
232233[ #980 ] : https://github.com/xi-editor/druid/pull/980
233234[ #982 ] : https://github.com/xi-editor/druid/pull/982
235+ [ #984 ] : https://github.com/xi-editor/druid/pull/984
234236
235237## [ 0.5.0] - 2020-04-01
236238
Original file line number Diff line number Diff line change @@ -157,7 +157,6 @@ impl<T: Data> Harness<'_, T> {
157157 window_size,
158158 } ;
159159 harness_closure ( & mut harness) ;
160- harness. piet . finish ( ) . expect ( "piet finish failed" ) ;
161160 }
162161 render_context_closure ( target)
163162 }
@@ -300,6 +299,16 @@ impl<T: Data> Inner<T> {
300299 }
301300}
302301
302+ impl < T > Drop for Harness < ' _ , T > {
303+ fn drop ( & mut self ) {
304+ // We need to call finish even if a test assert failed
305+ if let Err ( err) = self . piet . finish ( ) {
306+ // We can't panic, because we might already be panicking
307+ log:: error!( "piet finish failed: {}" , err) ;
308+ }
309+ }
310+ }
311+
303312impl Drop for TargetGuard < ' _ > {
304313 fn drop ( & mut self ) {
305314 // we need to call this to clean up the context
You can’t perform that action at this time.
0 commit comments