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



commit 6924bdbb1797d45ec23dabf76c7ac9dd039a003c
Author: SÃbastien Granjoux <seb sfo free fr>
Date:   Sun Oct 28 17:13:53 2012 +0100

    bgo #686702 - Reading the master member of GdlDockObject returns null pointer
    
    Prefix deprecated members by deprecated_ to get an error at compile time.

 gdl/gdl-dock-bar.h         |    2 +-
 gdl/gdl-dock-layout.c      |    6 +++---
 gdl/gdl-dock-layout.h      |    4 ++--
 gdl/gdl-dock-object.c      |   22 ++++++++++++++--------
 gdl/gdl-dock-object.h      |    6 +++---
 gdl/gdl-dock-placeholder.c |    4 ++--
 gdl/test-dock.c            |    5 ++---
 7 files changed, 27 insertions(+), 22 deletions(-)
---
diff --git a/gdl/gdl-dock-bar.h b/gdl/gdl-dock-bar.h
index 1e4f63a..8cc5b59 100644
--- a/gdl/gdl-dock-bar.h
+++ b/gdl/gdl-dock-bar.h
@@ -64,7 +64,7 @@ struct _GdlDockBar {
 
     /*< private >*/
 #ifndef GDL_DISABLE_DEPRECATED    
-    GdlDock *dock;
+    GdlDock *deprecated_dock;
 #endif
     GdlDockBarPrivate *priv;
 };
diff --git a/gdl/gdl-dock-layout.c b/gdl/gdl-dock-layout.c
index 21ff251..346e3de 100644
--- a/gdl/gdl-dock-layout.c
+++ b/gdl/gdl-dock-layout.c
@@ -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
 }
 
diff --git a/gdl/gdl-dock-layout.h b/gdl/gdl-dock-layout.h
index 82ed8ec..93e32bd 100644
--- a/gdl/gdl-dock-layout.h
+++ b/gdl/gdl-dock-layout.h
@@ -53,8 +53,8 @@ struct _GdlDockLayout {
 
     /*< private >*/
 #ifndef GDL_DISABLE_DEPRECATED    
-    gboolean              dirty;
-    GdlDockMaster        *master;
+    gboolean              deprecated_dirty;
+    GdlDockMaster        *deprecated_master;
 #endif    
     GdlDockLayoutPrivate *priv;
 };
diff --git a/gdl/gdl-dock-object.c b/gdl/gdl-dock-object.c
index 4d868e1..c0fabd3 100644
--- a/gdl/gdl-dock-object.c
+++ b/gdl/gdl-dock-object.c
@@ -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");
     }
diff --git a/gdl/gdl-dock-object.h b/gdl/gdl-dock-object.h
index d8c99b1..93c6ed9 100644
--- a/gdl/gdl-dock-object.h
+++ b/gdl/gdl-dock-object.h
@@ -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
diff --git a/gdl/gdl-dock-placeholder.c b/gdl/gdl-dock-placeholder.c
index ad4bc62..7d47f62 100644
--- a/gdl/gdl-dock-placeholder.c
+++ b/gdl/gdl-dock-placeholder.c
@@ -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));
     
diff --git a/gdl/test-dock.c b/gdl/test-dock.c
index 954b4ca..24540d5 100644
--- a/gdl/test-dock.c
+++ b/gdl/test-dock.c
@@ -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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]