Fix memory leak
This commit is contained in:
committed by
Gaël Bonithon
parent
db725cbc5c
commit
bfe5308f05
@@ -40,6 +40,7 @@ struct _XtmProcessMonitor
|
||||
};
|
||||
G_DEFINE_TYPE (XtmProcessMonitor, xtm_process_monitor, GTK_TYPE_DRAWING_AREA)
|
||||
|
||||
static void xtm_process_monitor_finalize (GObject *object);
|
||||
static void xtm_process_monitor_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
|
||||
static void xtm_process_monitor_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
|
||||
static gboolean xtm_process_monitor_draw (GtkWidget *widget, cairo_t *cr);
|
||||
@@ -53,6 +54,7 @@ xtm_process_monitor_class_init (XtmProcessMonitorClass *klass)
|
||||
GObjectClass *class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
xtm_process_monitor_parent_class = g_type_class_peek_parent (klass);
|
||||
class->finalize = xtm_process_monitor_finalize;
|
||||
class->get_property = xtm_process_monitor_get_property;
|
||||
class->set_property = xtm_process_monitor_set_property;
|
||||
widget_class->draw = xtm_process_monitor_draw;
|
||||
@@ -70,6 +72,17 @@ xtm_process_monitor_init (XtmProcessMonitor *monitor)
|
||||
monitor->history_swap = g_array_new (FALSE, TRUE, sizeof (gfloat));
|
||||
}
|
||||
|
||||
static void
|
||||
xtm_process_monitor_finalize (GObject *object)
|
||||
{
|
||||
XtmProcessMonitor *monitor = XTM_PROCESS_MONITOR (object);
|
||||
|
||||
g_array_free (monitor->history, TRUE);
|
||||
g_array_free (monitor->history_swap, TRUE);
|
||||
|
||||
G_OBJECT_CLASS (xtm_process_monitor_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
xtm_process_monitor_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user