Convert CpuGraph* to Ptr<CPUGraph>
The purpose of this patch is to slightly simplify CPUGraph
memory cleanup procedure and to make it virtually impossible to encounter a use-after-free error at runtime.
CPUGraph
's destructor is automatically called after all pointers to the CPUGraph
instance have been destroyed. This can be verified via a console info message generated when removing the cpugraph plugin from the panel (if xfce4-panel
is started with the G_MESSAGES_DEBUG
environment variable set to "all"). A similar message is printed in the case of CPUGraphOptions
's destructor.
Instance functions (methods) of CPUGraph
have been converted to static member functions because the concept of a reference-counted pointer is incompatible with the default binary representation of heap-allocated C++ objects. In other words, C++ doesn't have native support for reference counting.
Other changes:
- Add new
xfce4::connect()
variants - Add
xfce4::trim(std::string)