diff options
author | Neil <nyamatongwe@gmail.com> | 2017-04-15 16:47:52 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2017-04-15 16:47:52 +1000 |
commit | faf57f45eae60a257a8076c83c71c422486f88ce (patch) | |
tree | bae925421b4048bc7de7784e38d73b9960e85553 /gtk | |
parent | 75dba090f235fc4d24691bd1b57928f89ebe9f1b (diff) | |
download | scintilla-mirror-faf57f45eae60a257a8076c83c71c422486f88ce.tar.gz |
Avoid calling virtual functions in constructors and destructors.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/PlatGTK.cxx | 9 | ||||
-rw-r--r-- | gtk/ScintillaGTK.cxx | 7 | ||||
-rw-r--r-- | gtk/ScintillaGTK.h | 2 |
3 files changed, 11 insertions, 7 deletions
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index 8a00fcdad..8b0c997da 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -168,6 +168,7 @@ public: void Init(SurfaceID sid, WindowID wid) override; void InitPixMap(int width, int height, Surface *surface_, WindowID wid) override; + void Clear(); void Release() override; bool Initialised() override; void PenColour(ColourDesired fore) override; @@ -276,10 +277,10 @@ x(0), y(0), inited(false), createdGC(false) } SurfaceImpl::~SurfaceImpl() { - Release(); + Clear(); } -void SurfaceImpl::Release() { +void SurfaceImpl::Clear() { et = singleByte; if (createdGC) { createdGC = false; @@ -303,6 +304,10 @@ void SurfaceImpl::Release() { createdGC = false; } +void SurfaceImpl::Release() { + Clear(); +} + bool SurfaceImpl::Initialised() { #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 8, 0) if (inited && context) { diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index 75876dc53..52d0ed7e7 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -205,7 +205,7 @@ ScintillaGTK::ScintillaGTK(_ScintillaObject *sci_) : lastWheelMouseTime.tv_sec = 0; lastWheelMouseTime.tv_usec = 0; - Initialise(); + Init(); } ScintillaGTK::~ScintillaGTK() { @@ -549,8 +549,7 @@ void ScintillaGTK::SizeAllocate(GtkWidget *widget, GtkAllocation *allocation) { } } -void ScintillaGTK::Initialise() { - //Platform::DebugPrintf("ScintillaGTK::Initialise\n"); +void ScintillaGTK::Init() { parentClass = reinterpret_cast<GtkWidgetClass *>( g_type_class_ref(gtk_container_get_type())); @@ -3044,7 +3043,7 @@ void ScintillaGTK::ClassInit(OBJECT_CLASS* object_class, GtkWidgetClass *widget_ // Define default signal handlers for the class: Could move more // of the signal handlers here (those that currently attached to wDraw - // in Initialise() may require coordinate translation?) + // in Init() may require coordinate translation?) object_class->dispose = Dispose; object_class->finalize = Destroy; diff --git a/gtk/ScintillaGTK.h b/gtk/ScintillaGTK.h index 95ad953f0..d59a4ef29 100644 --- a/gtk/ScintillaGTK.h +++ b/gtk/ScintillaGTK.h @@ -81,7 +81,7 @@ public: static ScintillaGTK *FromWidget(GtkWidget *widget); static void ClassInit(OBJECT_CLASS* object_class, GtkWidgetClass *widget_class, GtkContainerClass *container_class); private: - virtual void Initialise(); + void Init(); virtual void Finalise(); virtual bool AbandonPaint(); virtual void DisplayCursor(Window::Cursor c); |