Author: Nikita Kitaev <[email protected]>
Date:   Thu May 19 23:51:38 2011 -0700

Fix crash on left-click: check that selected_bezier exists

---

 synfig-studio/src/gui/workarea.cpp |   28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/synfig-studio/src/gui/workarea.cpp 
b/synfig-studio/src/gui/workarea.cpp
index fdc2749..ed5abf4 100644
--- a/synfig-studio/src/gui/workarea.cpp
+++ b/synfig-studio/src/gui/workarea.cpp
@@ -1428,21 +1428,23 @@ WorkArea::on_drawing_area_event(GdkEvent *event)
                        else
                        
if(canvas_view->get_smach().process_event(EventMouse(EVENT_WORKAREA_MOUSE_BUTTON_DOWN,BUTTON_LEFT,mouse_pos,pressure,modifier))==Smach::RESULT_OK)
                        {
-                               synfig::Point distance_1 = 
selected_bezier->p1->get_trans_point() - mouse_pos;
-                               synfig::Point distance_2 = 
selected_bezier->p2->get_trans_point() - mouse_pos;
-                               if (selected_bezier
-                                       && distance_1.mag() > radius*2
-                                       && distance_2.mag() > radius*2
-                                       )
+                               if (selected_bezier)
+                               {
+                                       synfig::Point distance_1 = 
selected_bezier->p1->get_trans_point() - mouse_pos;
+                                       synfig::Point distance_2 = 
selected_bezier->p2->get_trans_point() - mouse_pos;
+                                       if( distance_1.mag() > radius*2
+                                           && distance_2.mag() > radius*2
+                                               )
                                        // If we click a selected bezier
                                        // not too close to the endpoints
-                               {
-                                       // We give the states first priority to 
process the
-                                       // event so as not to interfere with 
the bline tool
-                                       dragging=DRAG_BEZIER;
-                                       drag_point=mouse_pos;
-                                       start_bezier_drag(mouse_pos, 
bezier_click_pos);
-                                       return true;
+                                       {
+                                               // We give the states first 
priority to process the
+                                               // event so as not to interfere 
with the bline tool
+                                               dragging=DRAG_BEZIER;
+                                               drag_point=mouse_pos;
+                                               start_bezier_drag(mouse_pos, 
bezier_click_pos);
+                                               return true;
+                                       }
                                }
 // I commented out this section because
 // it was causing issues when rotoscoping.


------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to