Commit 6924bdbb authored by Sebastien Granjoux's avatar Sebastien Granjoux

bgo #686702 - Reading the master member of GdlDockObject returns null pointer

Prefix deprecated members by deprecated_ to get an error at compile time.
parent b7b54c87
......@@ -64,7 +64,7 @@ struct _GdlDockBar {
/*< private >*/
#ifndef GDL_DISABLE_DEPRECATED
GdlDock *dock;
GdlDock *deprecated_dock;
#endif
GdlDockBarPrivate *priv;
};
......
......@@ -153,8 +153,8 @@ gdl_dock_layout_init (GdlDockLayout *layout)
layout->priv->dirty = FALSE;
layout->priv->idle_save_pending = FALSE;
#ifndef GDL_DISABLE_DEPRECATED
layout->master = NULL;
layout->dirty = FALSE;
layout->deprecated_master = NULL;
layout->deprecated_dirty = FALSE;
#endif
}
......@@ -630,7 +630,7 @@ gdl_dock_layout_set_master (GdlDockLayout *layout,
layout->priv->master = NULL;
}
#ifndef GDL_DISABLE_DEPRECATED
layout->master = layout->priv->master;
layout->deprecated_master = layout->priv->master;
#endif
}
......
......@@ -53,8 +53,8 @@ struct _GdlDockLayout {
/*< private >*/
#ifndef GDL_DISABLE_DEPRECATED
gboolean dirty;
GdlDockMaster *master;
gboolean deprecated_dirty;
GdlDockMaster *deprecated_master;
#endif
GdlDockLayoutPrivate *priv;
};
......
......@@ -324,8 +324,8 @@ gdl_dock_object_init (GdlDockObject *object)
object->priv->automatic = TRUE;
object->priv->freeze_count = 0;
#ifndef GDL_DISABLE_DEPRECATED
object->flags = 0;
object->master = NULL;
object->deprecated_flags = 0;
object->deprecated_master = NULL;
#endif
}
......@@ -469,9 +469,9 @@ gdl_dock_object_update_parent_visibility (GdlDockObject *object)
parent->priv->attached = visible;
#ifndef GDL_DISABLE_DEPRECATED
if (visible)
parent->flags |= GDL_DOCK_ATTACHED;
parent->deprecated_flags |= GDL_DOCK_ATTACHED;
else
parent->flags &= ~GDL_DOCK_ATTACHED;
parent->deprecated_flags &= ~GDL_DOCK_ATTACHED;
#endif
gtk_widget_set_visible (GTK_WIDGET (parent), visible);
}
......@@ -493,7 +493,7 @@ gdl_dock_object_show (GtkWidget *widget)
{
GDL_DOCK_OBJECT (widget)->priv->attached = TRUE;
#ifndef GDL_DISABLE_DEPRECATED
GDL_DOCK_OBJECT (widget)->flags |= GDL_DOCK_ATTACHED;
GDL_DOCK_OBJECT (widget)->deprecated_flags |= GDL_DOCK_ATTACHED;
#endif
GTK_WIDGET_CLASS (gdl_dock_object_parent_class)->show (widget);
......@@ -506,7 +506,7 @@ gdl_dock_object_hide (GtkWidget *widget)
{
GDL_DOCK_OBJECT (widget)->priv->attached = FALSE;
#ifndef GDL_DISABLE_DEPRECATED
GDL_DOCK_OBJECT (widget)->flags &= ~GDL_DOCK_ATTACHED;
GDL_DOCK_OBJECT (widget)->deprecated_flags &= ~GDL_DOCK_ATTACHED;
#endif
GTK_WIDGET_CLASS (gdl_dock_object_parent_class)->hide (widget);
......@@ -533,7 +533,7 @@ gdl_dock_object_real_detach (GdlDockObject *object,
/* detach the object itself */
object->priv->attached = FALSE;
#ifndef GDL_DISABLE_DEPRECATED
object->flags &= ~GDL_DOCK_ATTACHED;
object->deprecated_flags &= ~GDL_DOCK_ATTACHED;
#endif
parent = gdl_dock_object_get_parent_object (object);
widget = GTK_WIDGET (object);
......@@ -865,7 +865,7 @@ gdl_dock_object_dock (GdlDockObject *object,
if (gtk_widget_get_visible (GTK_WIDGET (requestor))) {
requestor->priv->attached = TRUE;
#ifndef GDL_DISABLE_DEPRECATED
requestor->flags |= GDL_DOCK_ATTACHED;
requestor->deprecated_flags |= GDL_DOCK_ATTACHED;
#endif
}
/* Update visibility of automatic parents */
......@@ -899,6 +899,9 @@ gdl_dock_object_bind (GdlDockObject *object,
gdl_dock_master_add (GDL_DOCK_MASTER (master), object);
object->priv->master = master;
#ifndef GDL_DISABLE_DEPRECATED
object->deprecated_master = master;
#endif
g_object_add_weak_pointer (master, (gpointer *) &object->priv->master);
g_object_notify (G_OBJECT (object), "master");
......@@ -924,6 +927,9 @@ gdl_dock_object_unbind (GdlDockObject *object)
GObject *master = object->priv->master;
g_object_remove_weak_pointer (master, (gpointer *) &object->priv->master);
object->priv->master = NULL;
#ifndef GDL_DISABLE_DEPRECATED
object->deprecated_master = NULL;
#endif
gdl_dock_master_remove (GDL_DOCK_MASTER (master), object);
g_object_notify (G_OBJECT (object), "master");
}
......
......@@ -141,8 +141,8 @@ struct _GdlDockObject {
GtkContainer container;
#ifndef GDL_DISABLE_DEPRECATED
/* Just for compiling, these data are not initialized anymore */
GdlDockObjectFlags flags;
GObject *master;
GdlDockObjectFlags deprecated_flags;
GObject *deprecated_master;
#endif
/*< private >*/
GdlDockObjectPrivate *priv;
......@@ -191,7 +191,7 @@ struct _GdlDockObjectClass {
*
* Deprecated: 3.6: The flags are not accessible anymore.
*/
#define GDL_DOCK_OBJECT_FLAGS(obj) (GDL_DOCK_OBJECT (obj)->flags)
#define GDL_DOCK_OBJECT_FLAGS(obj) (GDL_DOCK_OBJECT (obj)->deprecated_flags)
#endif
#ifndef GDL_DISABLE_DEPRECATED
......
......@@ -850,9 +850,9 @@ gdl_dock_placeholder_attach (GdlDockPlaceholder *ph,
/* object binding */
if (!gdl_dock_object_is_bound (GDL_DOCK_OBJECT (ph)))
gdl_dock_object_bind (GDL_DOCK_OBJECT (ph), object->master);
gdl_dock_object_bind (GDL_DOCK_OBJECT (ph), object->deprecated_master);
g_return_if_fail (GDL_DOCK_OBJECT (ph)->master == object->master);
g_return_if_fail (GDL_DOCK_OBJECT (ph)->deprecated_master == object->deprecated_master);
gdl_dock_object_freeze (GDL_DOCK_OBJECT (ph));
......
......@@ -17,7 +17,7 @@ static void
on_style_button_toggled (GtkRadioButton *button, GdlDock *dock)
{
gboolean active;
GdlDockMaster *master = GDL_DOCK_OBJECT_GET_MASTER (dock);
GdlDockMaster *master = GDL_DOCK_MASTER (gdl_dock_object_get_master (GDL_DOCK_OBJECT (dock)));
GdlSwitcherStyle style =
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button),
"__style_id"));
......@@ -33,8 +33,7 @@ create_style_button (GtkWidget *dock, GtkWidget *box, GtkWidget *group,
{
GdlSwitcherStyle current_style;
GtkWidget *button1;
GdlDockMaster *master = GDL_DOCK_OBJECT_GET_MASTER (dock);
GdlDockMaster *master = GDL_DOCK_MASTER (gdl_dock_object_get_master (GDL_DOCK_OBJECT (dock)));
g_object_get (master, "switcher-style", &current_style, NULL);
button1 = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (group),
style_text);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment