summaryrefslogtreecommitdiff
path: root/libslab
diff options
context:
space:
mode:
authorWu Xiaotian <[email protected]>2019-01-01 01:53:53 +0800
committerraveit65 <[email protected]>2019-01-01 10:21:42 +0100
commitc5e048bd1b0d19198e2a0a9d60ddd58721e8f3d1 (patch)
tree5fa48d4f502a073975c9f292823bda157a39e90b /libslab
parent383d3da6dd3f9aedb6dd0b7710d9de7f232563cf (diff)
downloadmate-control-center-c5e048bd1b0d19198e2a0a9d60ddd58721e8f3d1.tar.bz2
mate-control-center-c5e048bd1b0d19198e2a0a9d60ddd58721e8f3d1.tar.xz
Fix the runtime warning about gtk_widget_destroy.
Diffstat (limited to 'libslab')
-rw-r--r--libslab/tile.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/libslab/tile.c b/libslab/tile.c
index 9d628f8b..712a61dc 100644
--- a/libslab/tile.c
+++ b/libslab/tile.c
@@ -35,6 +35,7 @@ typedef struct
} TilePrivate;
static void tile_finalize (GObject *);
+static void tile_dispose (GObject *);
static void tile_get_property (GObject *, guint, GValue *, GParamSpec *);
static void tile_set_property (GObject *, guint, const GValue *, GParamSpec *);
static GObject *tile_constructor (GType, guint, GObjectConstructParam *);
@@ -92,6 +93,7 @@ tile_class_init (TileClass * this_class)
g_obj_class->get_property = tile_get_property;
g_obj_class->set_property = tile_set_property;
g_obj_class->finalize = tile_finalize;
+ g_obj_class->dispose = tile_dispose;
widget_class->focus_in_event = tile_focus_in;
widget_class->focus_out_event = tile_focus_out;
@@ -175,19 +177,11 @@ tile_finalize (GObject * g_object)
if (tile->n_actions) /* this will also free "default_action" entry */
{
- gint x;
- for (x = 0; x < tile->n_actions; x++)
- {
- if (tile->actions[x])
- g_object_unref (tile->actions[x]);
- }
g_free (tile->actions);
}
if (tile->uri)
g_free (tile->uri);
- if (tile->context_menu)
- gtk_widget_destroy (GTK_WIDGET (tile->context_menu));
g_object_unref (priv->double_click_detector);
@@ -195,6 +189,33 @@ tile_finalize (GObject * g_object)
}
static void
+tile_dispose (GObject * g_object)
+{
+ Tile *tile = TILE (g_object);
+
+ /* free the TileAction object */
+ if (tile->n_actions)
+ {
+ gint x;
+ for (x = 0; x < tile->n_actions; x++)
+ {
+ if (tile->actions[x] != NULL) {
+ g_object_unref (tile->actions[x]);
+ tile->actions[x] = NULL;
+ }
+ }
+ }
+
+ /* free the GtkMenu object */
+ if (tile->context_menu != NULL) {
+ gtk_widget_destroy (GTK_WIDGET (tile->context_menu));
+ tile->context_menu = NULL;
+ }
+
+ (*G_OBJECT_CLASS (tile_parent_class)->dispose) (g_object);
+}
+
+static void
tile_get_property (GObject * g_obj, guint prop_id, GValue * value, GParamSpec * param_spec)
{
if (!IS_TILE (g_obj))