From 2445797e45f5e90eb5fd04c6678245e35dc72b10 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Thu, 7 Nov 2019 14:28:20 +0100 Subject: Reorganise use of virtual member function Fl_Surface_Device::end_current() --- src/Fl_Image_Surface.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/Fl_Image_Surface.cxx') diff --git a/src/Fl_Image_Surface.cxx b/src/Fl_Image_Surface.cxx index f58949c19..e0c5fe1fc 100644 --- a/src/Fl_Image_Surface.cxx +++ b/src/Fl_Image_Surface.cxx @@ -42,7 +42,10 @@ Fl_Image_Surface::Fl_Image_Surface(int w, int h, int high_res, Fl_Offscreen off) /** The destructor. */ -Fl_Image_Surface::~Fl_Image_Surface() { delete platform_surface; } +Fl_Image_Surface::~Fl_Image_Surface() { + if (is_current()) platform_surface->end_current(); + delete platform_surface; +} void Fl_Image_Surface::origin(int x, int y) {platform_surface->origin(x, y);} -- cgit v1.2.3