Recent

Author Topic: Another external sigsegv problem  (Read 6554 times)

Irvine

  • New member
  • *
  • Posts: 8
Another external sigsegv problem
« on: January 25, 2010, 07:36:08 pm »
I have been doing a lot of Google-ing trying to find an answer to my problem and while there it does seem to be fairly common can't find anything that is directly applicable. I am running Lazarus on  Ubuntu and for the moment am trying to write some short routines that initialize  the image of an image box at runtime, then change the image  when the image box is right clicked.

Here is the relevant code, it compiles okay but I get an "external sigsegv" exception when it runs. (occasionaly I get a 216 error on a second attempt at running.)

Quote
Procedure Set_image;
Begin
    Form1.icon_map.GetBitmap(0, Form1.X1Y1.Picture.Bitmap); //external sigsegv
     state := 'img1'
end;

procedure TForm1.X1Y1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
     If Button = mbRight Then
       Begin
           If state = 'img1'   Then
              Begin
                  Form1.icon_map.GetBitmap(1, Form1.X1Y1.Picture.Bitmap);
                  state := 'img2'
              end
             Else
              If state = 'img2'  Then
                Begin
                    Form1.icon_map.GetBitmap(2, Form1.X1Y1.Picture.Bitmap);
                    state := 'img3'
                end
                Else
                  Begin
                      Form1.icon_map.GetBitmap(0, Form1.X1Y1.Picture.Bitmap);
                      state := 'img1'
                  end
       end;
end;     

 

I would be grateful if someone could help out with this, the breadth and variety of posted reasons for this error is astounding.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2583
Re: Another external sigsegv problem
« Reply #1 on: January 25, 2010, 08:25:42 pm »
What is Form1.icon_map and when is Set_image called

Please give us a compilable example showing your problem. With the individual lines is nothing wrong.
« Last Edit: January 25, 2010, 08:27:55 pm by Marc »
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
Re: Another external sigsegv problem
« Reply #2 on: January 25, 2010, 08:28:05 pm »
It would be helpful if you told us what these cryptic names mean.
I guess "icon_map" is a TImageList and "X1Y1" is a TImage, right?
I cannot reproduce the problem in this case.
What is your Lazarus Version and OS?
When are you calling Set_image?

SIGSEGV means the same as "access violation". It is rather unspecific, see:
http://en.wikipedia.org/wiki/SIGSEGV

EDIT: Sry Marc, you were faster ;-)

Irvine

  • New member
  • *
  • Posts: 8
Re: Another external sigsegv problem
« Reply #3 on: January 25, 2010, 08:51:54 pm »
Thanks for responding, I kept on Google-ing and  managed to figure out what was wrong and was posting this  post as solved when you replied.

Basically I was not initializing the Timage properly. I thought I was and it compiled okay, but.....

For anyone else searching these forums the Wikipedia article on "external sigsegv errors" puts everything in the correct context and thus helps a lot.

Also, just to finish:

        "Form1.icon_map" is a TimageList
        Set_image is  called by TForm1.FormCreate at form creation.

That was the mistake I was making, I was trying to initialize it during the initialization section. (Okay, so I am stupid. but I learned Pascal a very long time ago and Objects really make me feel like a dinosaur.)

Anyway, thank you for your prompt attention.

 :-[

 

TinyPortal © 2005-2018