Frank Eory wrote:
> Ian,
> I am using Debian  based Knoppix with kernel 2.6.9 and gcc 4.2.1. I've been 
> trying to strip out as much as the code while still leaving the error inside. 
> Basically, If I call an myslider->value(1), the Fl_Valuator (the class from 
> which the Fl_slider is derived) simply stores another value. In the 
> code::blocks watch window, I put a myslider->value() while stepping into 
> myslider->value(1) and checking the dissasembly.
> 
> int Fl_Valuator::value(double v) {
>   clear_changed();
>   if (v == value_) return 0;
>   value_ = v;      /*goes bad here*/
> .  value_damage();
>   return 1;
> }
> 
> Dissassembly gives for the value_=v line:
> mov eax, dword ptr[ebp+8] /* set up address for value that will be offseted 
> by 68*/
> fld qword ptr [ebp-8]   /*float point load from pointer*/
> fstp qword ptr[eax+68] /*float point store at pointer*/

        First: I'd advise: check to see if the value of "this" is NULL.
        ie. if the 'this' for the instance of Fl_Valuator is NULL.

        If 'this' is NULL, that could cause value_ = v to corrupt memory
        and crash.

        If "this" is NULL, then the question is why, and you should be able
        to trace that back.

        Or if its not NULL, add a printf() to you code printing the hex
        value of the Fl_Valuator instance at the time the widget was created,
        and compare that to what 'this' is at the time the above code is 
running.
        If the two values are not the same, that's the problem.

        There should be no problem with "value_ = v" otherwise, as both
        are double's. So the only likely reason for the crash is if 'this'
        is pointing somewhere it shouldn't.

> The gdb in code blocks doesn't let me inspect the memory. I try putting 
> variations of *(hex addresss) but it does not work.

        If gdb won't let you do it, stick some printf()s in the fltk code
        to make it do what you want.

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to