From 0d3a37439625e60cf247228412007fabd04ad289 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Sat, 25 May 2019 11:59:16 +0200 Subject: Call virtual member Fl_Surface_Device::end_current() when necessary Rename member function Fl_Surface_Device::end_current_() to end_current(), set it protected, and make it called by the destructor of all classes derived from Fl_Surface_Device that re-implement end_current(). This way, end_current() runs equally if Fl_Surface_Device()::pop_current() is called before or after the drawing surface is deleted. --- FL/Fl_Device.H | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'FL') diff --git a/FL/Fl_Device.H b/FL/Fl_Device.H index b017e17f3..3a31a49b7 100644 --- a/FL/Fl_Device.H +++ b/FL/Fl_Device.H @@ -70,10 +70,10 @@ class FL_EXPORT Fl_Surface_Device { Fl_Graphics_Driver *pGraphicsDriver; static Fl_Surface_Device *surface_; // the surface that currently receives graphics requests static Fl_Surface_Device *default_surface(); // create surface if none exists yet +protected: /* Some drawing surfaces (e.g., Fl_XXX_Image_Surface_Driver) re-implement this. Gets called each time a surface ceases to be the current drawing surface. */ - virtual void end_current_() {} -protected: + virtual void end_current() {} /** Constructor that sets the graphics driver to use for the created surface. */ Fl_Surface_Device(Fl_Graphics_Driver *graphics_driver) {pGraphicsDriver = graphics_driver; } /** Sets the graphics driver of this drawing surface. */ -- cgit v1.2.3