From 8e9f1ad900f718cbbf2d529bbd5606845902feaa Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 17 Nov 2014 22:18:25 +0100 Subject: Fixes crash with perspective_lpe (bzr r13725) --- src/live_effects/lpe-perspective_path.cpp | 40 ++++++++++++++++++------------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'src/live_effects/lpe-perspective_path.cpp') diff --git a/src/live_effects/lpe-perspective_path.cpp b/src/live_effects/lpe-perspective_path.cpp index d43772cf7..5183a455f 100644 --- a/src/live_effects/lpe-perspective_path.cpp +++ b/src/live_effects/lpe-perspective_path.cpp @@ -44,6 +44,8 @@ public: } // namespace PP static Glib::ustring perspectiveID = _("First perspective"); + + LPEPerspectivePath::LPEPerspectivePath(LivePathEffectObject *lpeobject) : Effect(lpeobject), // initialise your parameters here: @@ -62,35 +64,41 @@ LPEPerspectivePath::LPEPerspectivePath(LivePathEffectObject *lpeobject) : concatenate_before_pwd2 = true; // don't split the path into its subpaths _provides_knotholder_entities = true; - unapply = false; - Persp3D *persp = persp3d_document_first_persp(lpeobject->document); +} + +LPEPerspectivePath::~LPEPerspectivePath() +{ + +} +void +LPEPerspectivePath::doOnApply(SPLPEItem const* lpeitem) +{ + Persp3D *persp = persp3d_document_first_persp(lpeitem->document); if(persp == 0 ){ char *msg = _("You need a BOX 3D object"); Gtk::MessageDialog dialog(msg, false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true); dialog.run(); - unapply = true; - return; + SPLPEItem * item = const_cast(lpeitem); + item->removeCurrentPathEffect(false); } - Proj::TransfMat3x4 pmat = persp->perspective_impl->tmat; - pmat = pmat * SP_ACTIVE_DESKTOP->doc2dt(); - pmat.copy_tmat(tmat); -} - -LPEPerspectivePath::~LPEPerspectivePath() -{ - } - void LPEPerspectivePath::doBeforeEffect (SPLPEItem const* lpeitem) { original_bbox(lpeitem, true); - if(unapply){ - SP_LPE_ITEM(lpeitem)->removeCurrentPathEffect(false); + SPLPEItem * item = const_cast(lpeitem); + Persp3D *persp = persp3d_document_first_persp(lpeitem->document); + if(persp == 0 ){ + char *msg = _("You need a BOX 3D object"); + Gtk::MessageDialog dialog(msg, false, Gtk::MESSAGE_INFO, + Gtk::BUTTONS_OK, true); + dialog.run(); return; } - SPLPEItem * item = const_cast(lpeitem); + Proj::TransfMat3x4 pmat = persp->perspective_impl->tmat; + pmat = pmat * SP_ACTIVE_DESKTOP->doc2dt(); + pmat.copy_tmat(tmat); item->apply_to_clippath(item); item->apply_to_mask(item); } -- cgit v1.2.3