From d3f7382feed4805fda56b5f5803b5e917d1e292f Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Mon, 24 Oct 2016 12:22:26 +0200 Subject: GTK: Add some documentation on accessible object reference ownerships --- gtk/ScintillaGTKAccessible.cxx | 22 ++++++++++++++++++++++ gtk/ScintillaGTKAccessible.h | 1 + 2 files changed, 23 insertions(+) diff --git a/gtk/ScintillaGTKAccessible.cxx b/gtk/ScintillaGTKAccessible.cxx index e1f450467..30679ccae 100644 --- a/gtk/ScintillaGTKAccessible.cxx +++ b/gtk/ScintillaGTKAccessible.cxx @@ -3,6 +3,28 @@ /* Copyright 2016 by Colomban Wendling * The License.txt file describes the conditions under which this software may be distributed. */ +// REFERENCES BETWEEN THE DIFFERENT OBJECTS +// +// ScintillaGTKAccessible is the actual implementation, as a C++ class. +// ScintillaObjectAccessible is the GObject derived from AtkObject that +// implements the various ATK interfaces, through ScintillaGTKAccessible. +// This follows the same pattern as ScintillaGTK and ScintillaObject. +// +// ScintillaGTK owns a strong reference to the ScintillaObjectAccessible, and +// is both responsible for creating and destroying that object. +// +// ScintillaObjectAccessible owns a strong reference to ScintillaGTKAccessible, +// and is responsible for creating and destroying that object. +// +// ScintillaGTKAccessible has weak references to both the ScintillaGTK and +// the ScintillaObjectAccessible objects associated, but does not own any +// strong references to those objects. +// +// The chain of ownership is as follows: +// ScintillaGTK -> ScintillaObjectAccessible -> ScintillaGTKAccessible + +// DETAILS ON THE GOBJECT TYPE IMPLEMENTATION +// // On GTK < 3.2, we need to use the AtkObjectFactory. We need to query // the factory to see what type we should derive from, thus making use of // dynamic inheritance. It's tricky, but it works so long as it's done diff --git a/gtk/ScintillaGTKAccessible.h b/gtk/ScintillaGTKAccessible.h index 5614c88e2..93883025d 100644 --- a/gtk/ScintillaGTKAccessible.h +++ b/gtk/ScintillaGTKAccessible.h @@ -16,6 +16,7 @@ namespace Scintilla { class ScintillaGTKAccessible { private: + // weak references to related objects GtkAccessible *accessible; ScintillaGTK *sci; -- cgit v1.2.3