diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-02-05 13:50:26 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-02-05 13:50:26 +0100 |
| commit | 49475a44169acac768d496d7aca232dacbb2ae6d (patch) | |
| tree | 4fe05fda320f55ef3002065dc93ea6c3153cc1d1 | |
| parent | 6e7c61cdaedca8056ed3c70f678b82e453ef4fe1 (diff) | |
Cleanup: use ScopeGuard.
| -rw-r--r-- | src/wx/timeline.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index 2a8555e7c..604a00f39 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -35,6 +35,7 @@ #include "lib/film.h" #include "lib/image_content.h" #include "lib/playlist.h" +#include "lib/scope_guard.h" #include "lib/text_content.h" #include "lib/timer.h" #include "lib/video_content.h" @@ -155,13 +156,13 @@ Timeline::paint_labels () return; } + ScopeGuard sg = [gc]() { delete gc; }; + int vsx, vsy; _labels_canvas->GetViewStart (&vsx, &vsy); gc->Translate (-vsx * _x_scroll_rate, -vsy * _y_scroll_rate + tracks_y_offset()); _labels_view->paint (gc, {}); - - delete gc; } @@ -176,6 +177,8 @@ Timeline::paint_main () return; } + ScopeGuard sg = [gc]() { delete gc; }; + int vsx, vsy; _main_canvas->GetViewStart (&vsx, &vsy); gc->Translate (-vsx * _x_scroll_rate, -vsy * _y_scroll_rate); @@ -225,8 +228,6 @@ Timeline::paint_main () path.MoveToPoint (ph, 0); path.AddLineToPoint (ph, pixels_per_track() * _tracks + 32); gc->StrokePath (path); - - delete gc; } |
