@@ -35,6 +35,7 @@ typedef struct
3535} TilePrivate ;
3636
3737static void tile_finalize (GObject * );
38+ static void tile_dispose (GObject * );
3839static void tile_get_property (GObject * , guint , GValue * , GParamSpec * );
3940static void tile_set_property (GObject * , guint , const GValue * , GParamSpec * );
4041static GObject * tile_constructor (GType , guint , GObjectConstructParam * );
@@ -92,6 +93,7 @@ tile_class_init (TileClass * this_class)
9293 g_obj_class -> get_property = tile_get_property ;
9394 g_obj_class -> set_property = tile_set_property ;
9495 g_obj_class -> finalize = tile_finalize ;
96+ g_obj_class -> dispose = tile_dispose ;
9597
9698 widget_class -> focus_in_event = tile_focus_in ;
9799 widget_class -> focus_out_event = tile_focus_out ;
@@ -175,25 +177,44 @@ tile_finalize (GObject * g_object)
175177
176178 if (tile -> n_actions ) /* this will also free "default_action" entry */
177179 {
178- gint x ;
179- for (x = 0 ; x < tile -> n_actions ; x ++ )
180- {
181- if (tile -> actions [x ])
182- g_object_unref (tile -> actions [x ]);
183- }
184180 g_free (tile -> actions );
185181 }
186182
187183 if (tile -> uri )
188184 g_free (tile -> uri );
189- if (tile -> context_menu )
190- gtk_widget_destroy (GTK_WIDGET (tile -> context_menu ));
191185
192186 g_object_unref (priv -> double_click_detector );
193187
194188 (* G_OBJECT_CLASS (tile_parent_class )-> finalize ) (g_object );
195189}
196190
191+ static void
192+ tile_dispose (GObject * g_object )
193+ {
194+ Tile * tile = TILE (g_object );
195+
196+ /* free the TileAction object */
197+ if (tile -> n_actions )
198+ {
199+ gint x ;
200+ for (x = 0 ; x < tile -> n_actions ; x ++ )
201+ {
202+ if (tile -> actions [x ] != NULL ) {
203+ g_object_unref (tile -> actions [x ]);
204+ tile -> actions [x ] = NULL ;
205+ }
206+ }
207+ }
208+
209+ /* free the GtkMenu object */
210+ if (tile -> context_menu != NULL ) {
211+ gtk_widget_destroy (GTK_WIDGET (tile -> context_menu ));
212+ tile -> context_menu = NULL ;
213+ }
214+
215+ (* G_OBJECT_CLASS (tile_parent_class )-> dispose ) (g_object );
216+ }
217+
197218static void
198219tile_get_property (GObject * g_obj , guint prop_id , GValue * value , GParamSpec * param_spec )
199220{
0 commit comments