From: joncruz Date: Thu, 3 Apr 2008 06:04:53 +0000 (+0000) Subject: Fixed LPE crash with unitialized pointer X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1d9fba0b575543bc3c0d2e9f15b51e44be93893c;p=inkscape.git Fixed LPE crash with unitialized pointer --- diff --git a/src/forward.h b/src/forward.h index 0cab048e0..d4a98fbff 100644 --- a/src/forward.h +++ b/src/forward.h @@ -1,5 +1,5 @@ -#ifndef __FORWARD_H__ -#define __FORWARD_H__ +#ifndef FORWARD_H_SEEN +#define FORWARD_H_SEEN /* * Forward declarations of most used objects @@ -59,6 +59,7 @@ class SPObjectClass; #define SP_TYPE_OBJECT (sp_object_get_type ()) #define SP_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_OBJECT, SPObject)) +#define SP_OBJECT_CLASS(clazz) (G_TYPE_CHECK_CLASS_CAST((clazz), SP_TYPE_OBJECT, SPObjectClass)) #define SP_IS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_OBJECT)) GType sp_object_get_type (); @@ -68,6 +69,7 @@ class SPItemClass; #define SP_TYPE_ITEM (sp_item_get_type ()) #define SP_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_ITEM, SPItem)) +#define SP_ITEM_CLASS(clazz) (G_TYPE_CHECK_CLASS_CAST((clazz), SP_TYPE_ITEM, SPItemClass)) #define SP_IS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_ITEM)) GType sp_item_get_type (); @@ -193,7 +195,7 @@ namespace Inkscape { class Verb; } -#endif /* !__FORWARD_H__ */ +#endif // FORWARD_H_SEEN /* Local Variables: diff --git a/src/sp-object.h b/src/sp-object.h index 3c938e8a1..f30654c12 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -1,5 +1,5 @@ -#ifndef __SP_OBJECT_H__ -#define __SP_OBJECT_H__ +#ifndef SP_OBJECT_H_SEEN +#define SP_OBJECT_H_SEEN /** \file * Abstract base class for all nodes @@ -221,15 +221,15 @@ struct SPObject : public GObject { SPObject *lastChild() { return _last_child; } SPObject const *lastChild() const { return _last_child; } - enum Action { ActionGeneral, ActionBBox, ActionUpdate, ActionShow }; + enum Action { ActionGeneral, ActionBBox, ActionUpdate, ActionShow }; /** @brief Retrieves children as a GSList */ GSList *childList(bool add_ref, Action action = ActionGeneral); SPObject *appendChildRepr(Inkscape::XML::Node *repr); - /** @brief Gets the author-visible label for this object. */ + /** @brief Gets the author-visible label for this object. */ gchar const *label() const; - /** @brief Returns a default label for this object. */ + /** @brief Returns a default label for this object. */ gchar const *defaultLabel() const; /** @brief Sets the author-visible label for this object. * @@ -556,7 +556,7 @@ void sp_object_removeAttribute(SPObject *object, gchar const *key, SPException * /* Style */ gchar const *sp_object_get_style_property(SPObject const *object, - gchar const *key, gchar const *def); + gchar const *key, gchar const *def); Inkscape::Version sp_object_get_sodipodi_version(SPObject *object); @@ -565,7 +565,7 @@ int sp_object_compare_position(SPObject const *first, SPObject const *second); SPObject *sp_object_prev(SPObject *child); -#endif +#endif // SP_OBJECT_H_SEEN /* diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index 1556226f1..e45245793 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -1,5 +1,3 @@ -#define __SP_SHAPE_C__ - /* * Base class for shapes, including element * @@ -100,16 +98,12 @@ sp_shape_get_type (void) static void sp_shape_class_init (SPShapeClass *klass) { - GObjectClass *gobject_class; - SPObjectClass *sp_object_class; - SPItemClass * item_class; - SPLPEItemClass * lpe_item_class; - - gobject_class = (GObjectClass *) klass; - sp_object_class = (SPObjectClass *) klass; - item_class = (SPItemClass *) klass; + GObjectClass *gobject_class = G_OBJECT_CLASS(klass); + SPObjectClass *sp_object_class = SP_OBJECT_CLASS(klass); + SPItemClass * item_class = SP_ITEM_CLASS(klass); + SPLPEItemClass * lpe_item_class = SP_LPE_ITEM_CLASS(klass); - parent_class = (SPLPEItemClass *)g_type_class_peek_parent (klass); + parent_class = (SPLPEItemClass *)g_type_class_peek_parent (klass); gobject_class->finalize = sp_shape_finalize;