Applied the following dooglus patches from the sourceforge tracker:
authorxerakko <xerakko@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Sat, 18 Nov 2006 09:37:35 +0000 (09:37 +0000)
committerxerakko <xerakko@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Sat, 18 Nov 2006 09:37:35 +0000 (09:37 +0000)
synfig

  - 1576355: main1 - variable used after it's been free'd
  - 1576389: main2 - missing command line argument can crash synfig
  - 1571307: initialise - several variables are used before they are set
  - 1576373: gif1 - invalid palette entries are accessed
  - 1568922: blur2 - poor granularity in blur sizes
  - 1569078: typo: "aperature"

synfigstudio

  - 1571307: initialise, initialise2 - several variables are used before they are set
  - gamma settings were breaking due to using the localised form and causing weird colours
  - 1570191: distance - Widget_Distance don't notice when the units are changed
  - 1570319: blinewidth - default bline width is accessed before it is set

git-svn-id: http://svn.voria.com/code@229 1f10aa63-cdf2-0310-b900-c93c546f37ac

13 files changed:
synfig-core/trunk/src/modules/mod_gif/trgt_gif.cpp
synfig-core/trunk/src/synfig/blur.cpp
synfig-core/trunk/src/synfig/layer_motionblur.cpp
synfig-core/trunk/src/synfig/target.cpp
synfig-core/trunk/src/tool/main.cpp
synfig-studio/trunk/src/gtkmm/dock_navigator.cpp
synfig-studio/trunk/src/gtkmm/preview.cpp
synfig-studio/trunk/src/gtkmm/widget_defaults.cpp
synfig-studio/trunk/src/gtkmm/widget_distance.cpp
synfig-studio/trunk/src/gtkmm/widget_timeslider.cpp
synfig-studio/trunk/src/gtkmm/workarea.cpp
synfig-studio/trunk/src/synfigapp/action.h
synfig-studio/trunk/src/synfigapp/cvs.cpp

index 477b233..54a6e03 100644 (file)
@@ -165,7 +165,7 @@ gif::output_curr_palette()
        // Output the color table
        for(i=0;i<256/(1<<(8-rootsize));i++)
        {
-//             if(i && (i-1)<curr_palette.size())
+               if(i<(signed)curr_palette.size())
                {
                        Color color(curr_palette[i].color.clamped());
                        //fputc(i*(1<<(8-rootsize)),file.get());
@@ -175,13 +175,12 @@ gif::output_curr_palette()
                        fputc(gamma().g_F32_to_U8(color.get_g()),file.get());
                        fputc(gamma().b_F32_to_U8(color.get_b()),file.get());
                }
-/*             else
+               else
                {
                        fputc(255,file.get());
                        fputc(0,file.get());
                        fputc(255,file.get());
                }
-*/
        }
 }
 
index 5620281..2b481f0 100644 (file)
@@ -617,24 +617,24 @@ bool Blur::operator ()(const Surface &surface,
                        //horizontal part
                        if(size[0])
                        {
-                               int length=(int)(abs((float)w/(resolution[0]))*size[0]*0.5+1);
-                               length=std::max(1,length);
+                               Real length=abs((float)w/(resolution[0]))*size[0]*0.5+1;
+                               length=std::max(1.0,length);
                                
                                //two box blurs produces: 1 2 1
-                               etl::hbox_blur(worksurface.begin(),w,h,length*3/4,temp_surface.begin());
-                               etl::hbox_blur(temp_surface.begin(),w,h,length*3/4,worksurface.begin());
+                               etl::hbox_blur(worksurface.begin(),w,h,(int)(length*3/4),temp_surface.begin());
+                               etl::hbox_blur(temp_surface.begin(),w,h,(int)(length*3/4),worksurface.begin());
                        }
                        //else temp_surface2=worksurface;
                        
                        //vertical part
                        if(size[1])
                        {
-                               int length=(int)(abs((float)h/(resolution[1]))*size[1]*0.5+1);
-                               length=std::max(1,length);
+                               Real length=abs((float)h/(resolution[1]))*size[1]*0.5+1;
+                               length=std::max(1.0,length);
                                
                                //two box blurs produces: 1 2 1 on the horizontal 1 2 1
-                               etl::vbox_blur(worksurface.begin(),w,h,length*3/4,temp_surface.begin());
-                               etl::vbox_blur(temp_surface.begin(),w,h,length*3/4,worksurface.begin());
+                               etl::vbox_blur(worksurface.begin(),w,h,(int)(length*3/4),temp_surface.begin());
+                               etl::vbox_blur(temp_surface.begin(),w,h,(int)(length*3/4),worksurface.begin());
                        }
                        //else temp_surface2=temp_surface2;
        
@@ -993,24 +993,24 @@ bool Blur::operator ()(const surface<float> &surface,
                        //horizontal part
                        if(size[0])
                        {
-                               int length=(int)(abs((float)w/(resolution[0]))*size[0]*0.5+1);
-                               length=std::max(1,length);
+                               Real length=abs((float)w/(resolution[0]))*size[0]*0.5+1;
+                               length=std::max(1.0,length);
                                
                                //two box blurs produces: 1 2 1
-                               etl::hbox_blur(worksurface.begin(),w,h,length*3/4,temp_surface.begin());
-                               etl::hbox_blur(temp_surface.begin(),w,h,length*3/4,worksurface.begin());
+                               etl::hbox_blur(worksurface.begin(),w,h,(int)(length*3/4),temp_surface.begin());
+                               etl::hbox_blur(temp_surface.begin(),w,h,(int)(length*3/4),worksurface.begin());
                        }
                        //else temp_surface2=worksurface;
                        
                        //vertical part
                        if(size[1])
                        {
-                               int length=(int)(abs((float)h/(resolution[1]))*size[1]*0.5+1);
-                               length=std::max(1,length);
+                               Real length=abs((float)h/(resolution[1]))*size[1]*0.5+1;
+                               length=std::max(1.0,length);
                                
                                //two box blurs produces: 1 2 1 on the horizontal 1 2 1
-                               etl::vbox_blur(worksurface.begin(),w,h,length*3/4,temp_surface.begin());
-                               etl::vbox_blur(temp_surface.begin(),w,h,length*3/4,worksurface.begin());
+                               etl::vbox_blur(worksurface.begin(),w,h,(int)(length*3/4),temp_surface.begin());
+                               etl::vbox_blur(temp_surface.begin(),w,h,(int)(length*3/4),worksurface.begin());
                        }
                        //else temp_surface2=temp_surface2;
        
index b1782ee..6ac3673 100644 (file)
@@ -118,7 +118,7 @@ Layer_MotionBlur::get_param_vocab()const
        //ret=Layer_Composite::get_param_vocab();
        
        ret.push_back(ParamDesc("aperture")
-               .set_local_name(_("Aperature"))
+               .set_local_name(_("Aperture"))
                .set_description(_("Shutter Time"))
        );
        
index 988ac22..aa4b6f9 100644 (file)
@@ -89,7 +89,8 @@ Target::ext_book()
 Target::Target():
        quality_(4),
        gamma_(*default_gamma_),
-       remove_alpha(false)
+       remove_alpha(false),
+       avoid_time_sync_(false)
 {
 }
 
index eb609c5..c37a2b7 100644 (file)
@@ -67,7 +67,8 @@ enum exit_code
        SYNFIGTOOL_INVALIDTARGET                =6,     
        SYNFIGTOOL_RENDERFAILURE                =7,     
        SYNFIGTOOL_BLANK                                =8,
-       SYNFIGTOOL_BADVERSION           =9
+       SYNFIGTOOL_BADVERSION           =9,
+       SYNFIGTOOL_MISSINGARGUMENT      =10
 };
 
 #ifndef VERSION
@@ -565,6 +566,10 @@ int extract_arg_cluster(arg_list_t &arg_list,arg_list_t &cluster)
                        cluster.push_back(*iter);
                        arg_list.erase(iter);
                        iter=next++;
+                       if (iter==arg_list.end()) {
+                               error("The `%s' flag requires a value.  Use --help for a list of options.", cluster.back().c_str());
+                               return SYNFIGTOOL_MISSINGARGUMENT;
+                       }
                }
                        
                cluster.push_back(*iter);
@@ -588,14 +593,14 @@ int extract_RendDesc(arg_list_t &arg_list,RendDesc &desc)
                        w=atoi(iter->c_str());
                        arg_list.erase(iter);
                }
-               if(*iter=="-h")
+               else if(*iter=="-h")
                {
                        arg_list.erase(iter);
                        iter=next++;
                        h=atoi(iter->c_str());
                        arg_list.erase(iter);
                }
-               if(*iter=="-a")
+               else if(*iter=="-a")
                {
             int a;
                        arg_list.erase(iter);
@@ -605,7 +610,7 @@ int extract_RendDesc(arg_list_t &arg_list,RendDesc &desc)
                        VERBOSE_OUT(1)<<strprintf(_("Antialiasing set to %d, (%d samples per pixel)"),a,a*a)<<endl;
                        arg_list.erase(iter);
                }
-               if(*iter=="-s")
+               else if(*iter=="-s")
                {
                        arg_list.erase(iter);
                        iter=next++;
@@ -613,7 +618,7 @@ int extract_RendDesc(arg_list_t &arg_list,RendDesc &desc)
                        VERBOSE_OUT(1)<<strprintf(_("Span set to %d units"),span)<<endl;
                        arg_list.erase(iter);
                }
-               if(*iter=="--fps")
+               else if(*iter=="--fps")
                {
                        arg_list.erase(iter);
                        iter=next++;
@@ -622,7 +627,7 @@ int extract_RendDesc(arg_list_t &arg_list,RendDesc &desc)
                        arg_list.erase(iter);
                        VERBOSE_OUT(1)<<strprintf(_("Frame rate set to %d frames per second"),fps)<<endl;
                }
-               if(*iter=="--dpi")
+               else if(*iter=="--dpi")
                {
                        arg_list.erase(iter);
                        iter=next++;
@@ -632,7 +637,7 @@ int extract_RendDesc(arg_list_t &arg_list,RendDesc &desc)
                        arg_list.erase(iter);
                        VERBOSE_OUT(1)<<strprintf(_("Physical resolution set to %f dpi"),dpi)<<endl;
                }
-               if(*iter=="--dpi-x")
+               else if(*iter=="--dpi-x")
                {
                        arg_list.erase(iter);
                        iter=next++;
@@ -642,7 +647,7 @@ int extract_RendDesc(arg_list_t &arg_list,RendDesc &desc)
                        arg_list.erase(iter);
                        VERBOSE_OUT(1)<<strprintf(_("Physical X resolution set to %f dpi"),dpi)<<endl;
                }
-               if(*iter=="--dpi-y")
+               else if(*iter=="--dpi-y")
                {
                        arg_list.erase(iter);
                        iter=next++;
@@ -652,21 +657,21 @@ int extract_RendDesc(arg_list_t &arg_list,RendDesc &desc)
                        arg_list.erase(iter);
                        VERBOSE_OUT(1)<<strprintf(_("Physical Y resolution set to %f dpi"),dpi)<<endl;
                }
-               if(*iter=="--start-time" || *iter=="--begin-time")
+               else if(*iter=="--start-time" || *iter=="--begin-time")
                {
                        arg_list.erase(iter);
                        iter=next++;
                        desc.set_time_start(Time(*iter,desc.get_frame_rate()));
                        arg_list.erase(iter);
                }
-               if(*iter=="--end-time")
+               else if(*iter=="--end-time")
                {
                        arg_list.erase(iter);
                        iter=next++;
                        desc.set_time_end(Time(*iter,desc.get_frame_rate()));
                        arg_list.erase(iter);
                }
-               if(*iter=="--time")
+               else if(*iter=="--time")
                {
                        arg_list.erase(iter);
                        iter=next++;
@@ -674,7 +679,7 @@ int extract_RendDesc(arg_list_t &arg_list,RendDesc &desc)
                        VERBOSE_OUT(1)<<_("Rendering frame at ")<<desc.get_time_start().get_string(desc.get_frame_rate())<<endl;
                        arg_list.erase(iter);
                }
-               if(*iter=="-g")
+               else if(*iter=="-g")
                {
                        synfig::warning("Gamma argument is currently ignored");
                        //arg_list.erase(iter);
@@ -855,9 +860,11 @@ int main(int argc, char *argv[])
        
        {
                arg_list_t defaults, imageargs;
+               int ret;
                
                // Grab the defaults before the first file
-               extract_arg_cluster(arg_list,defaults);
+               if ((ret = extract_arg_cluster(arg_list,defaults)) != SYNFIGTOOL_OK)
+                 return ret;
                
                while(arg_list.size())
                {
@@ -869,7 +876,8 @@ int main(int argc, char *argv[])
                        job_list.front().filename=arg_list.front();
                        arg_list.pop_front();
 
-                       extract_arg_cluster(arg_list,imageargs);                        
+                       if ((ret = extract_arg_cluster(arg_list,imageargs)) != SYNFIGTOOL_OK)
+                         return ret;
                        
                        // Open the composition
                        {
index 7150dbb..b1b2c98 100644 (file)
@@ -65,6 +65,7 @@ const double log_10_2 = log(2.0);
 studio::Widget_NavView::Widget_NavView(CanvasView::LooseHandle cv)
 :canvview(cv),
 adj_zoom(0,-4,4,1,2),
+scrolling(false),
 surface(new synfig::Surface)
 {
        attach(drawto,0,4,0,1);
index ac24fdf..fc59738 100644 (file)
@@ -293,6 +293,8 @@ Widget_Preview::Widget_Preview()
 adj_time_scrub(0,0,1000,1,10,0),
 scr_time_scrub(adj_time_scrub),
 b_loop(/*_("Loop")*/),
+currentindex(0),
+audiotime(0),
 adj_sound(0,0,4),
 l_lasttime("0s"),
 playing(false)
index 7b450e9..307a71b 100644 (file)
@@ -258,6 +258,7 @@ Widget_Defaults::Widget_Defaults()
 
        widget_bline_width=manage(new Widget_Distance());
        widget_bline_width->show();
+       bline_width_refresh();
        widget_bline_width->set_digits(2);
        widget_bline_width->set_size_request(24,-1);
        widget_bline_width->signal_value_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::on_bline_width_changed));
@@ -314,7 +315,6 @@ Widget_Defaults::Widget_Defaults()
        fg_color_refresh();
        bg_color_refresh();
        gradient_refresh();
-       bline_width_refresh();
        blend_method_refresh();
        opacity_refresh();
        interpolation_refresh();
index 081775a..ec16d7d 100644 (file)
@@ -57,6 +57,7 @@ using namespace studio;
 
 Widget_Distance::Widget_Distance():
        Gtk::SpinButton(0.05,5),
+       distance_(1, Distance::SYSTEM_POINTS),
        adjustment(0,-100000000,100000000,1,1,1)
 //     adjustment(0,-100000000,100000000,1,2,0)
 {
index b4d1135..9f8891a 100644 (file)
@@ -316,6 +316,7 @@ Widget_Timeslider::Widget_Timeslider()
 adj_default(0,0,2,1/defaultfps,10/defaultfps),
 adj_timescale(0),
 //invalidated(false),
+last_event_time(0),
 fps(defaultfps),
 dragscroll(false)
 {
index ae5b909..1340f2a 100644 (file)
@@ -625,6 +625,9 @@ WorkArea::WorkArea(etl::loose_handle<synfigapp::CanvasInterface> canvas_interfac
        canvas(canvas_interface->get_canvas()),
        scrollx_adjustment(0,-4,4,0.01,0.1),
        scrolly_adjustment(0,-4,4,0.01,0.1),
+       w(128),
+       h(128),
+       last_event_time(0),
        progresscallback(0),
        dragging(DRAG_NONE),
        show_grid(false),
index f010e3e..8ea4302 100644 (file)
@@ -248,7 +248,7 @@ private:
 
 protected:
        CanvasSpecific(const synfig::Canvas::Handle &canvas):is_dirty_(true),mode_(MODE_UNDEFINED),canvas_(canvas) { }
-       CanvasSpecific():mode_(MODE_UNDEFINED) { }
+       CanvasSpecific():is_dirty_(true), mode_(MODE_UNDEFINED) { }
 
        virtual ~CanvasSpecific() { };
        
index a864c50..c1565ca 100644 (file)
@@ -203,11 +203,11 @@ CVSInfo::in_repository()const
 bool
 CVSInfo::is_modified()const
 {
+       if(!in_sandbox() || !in_repository())
+               return false;
 #ifdef _DEBUG
        synfig::info("%d-%d=%d",get_current_timestamp(),get_original_timestamp(),get_current_timestamp()-get_original_timestamp());
 #endif
-       if(!in_sandbox() || !in_repository())
-               return false;
        return get_current_timestamp()!=get_original_timestamp() && abs(get_current_timestamp()-get_original_timestamp())!=3600;
 }