From: Jon A. Cruz Date: Sun, 21 Mar 2010 22:16:39 +0000 (-0700) Subject: Fix crash X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6b6133b74e302813e042e743dd334221b053ae06;p=inkscape.git Fix crash --- diff --git a/src/widgets/paint-selector.cpp b/src/widgets/paint-selector.cpp index 892793543..3eaec1c23 100644 --- a/src/widgets/paint-selector.cpp +++ b/src/widgets/paint-selector.cpp @@ -125,9 +125,15 @@ static bool isPaintModeGradient( SPPaintSelectorMode mode ) static SPGradientSelector *getGradientFromData(SPPaintSelector *psel) { - // TODO g_message("FIXME FIXME"); - gchar const* key = (psel->mode == SP_PAINT_SELECTOR_MODE_SWATCH) ? "swatch-selector" : "gradient-selector"; - SPGradientSelector *grad = reinterpret_cast(gtk_object_get_data(GTK_OBJECT(psel->selector), key)); + SPGradientSelector *grad = 0; + if (psel->mode == SP_PAINT_SELECTOR_MODE_SWATCH) { + SwatchSelector *swatchsel = static_cast(g_object_get_data(G_OBJECT(psel->selector), "swatch-selector")); + if (swatchsel) { + grad = swatchsel->getGradientSelector(); + } + } else { + grad = reinterpret_cast(gtk_object_get_data(GTK_OBJECT(psel->selector), "gradient-selector")); + } return grad; } diff --git a/src/widgets/swatch-selector.cpp b/src/widgets/swatch-selector.cpp index a7bd5eae1..50ee632cd 100644 --- a/src/widgets/swatch-selector.cpp +++ b/src/widgets/swatch-selector.cpp @@ -57,6 +57,11 @@ SwatchSelector::~SwatchSelector() _gsel = 0; } +SPGradientSelector *SwatchSelector::getGradientSelector() +{ + return _gsel; +} + void SwatchSelector::_grabbedCb(SPColorSelector * /*csel*/, void * /*data*/) { } diff --git a/src/widgets/swatch-selector.h b/src/widgets/swatch-selector.h index cf1c24da1..83acf9fda 100644 --- a/src/widgets/swatch-selector.h +++ b/src/widgets/swatch-selector.h @@ -28,6 +28,8 @@ public: void setVector(SPDocument *doc, SPGradient *vector); + SPGradientSelector *getGradientSelector(); + private: static void _grabbedCb(SPColorSelector *csel, void *data); static void _draggedCb(SPColorSelector *csel, void *data);