[fpc-pascal] crash in tobject.free
Hi all, I'm encountering a consistent crash, and I'm not sure how to address the problem. using: - laz 0.9.28.2-8 beta, svn 22277, from debian testing -- a rather outdated one, because at this point upgrading lazarus requires updating debian - fpc 2.4.0-2 [2010/02/20] for i386 - fpgui commit e01c52a650bfdcce0bb1c8bbceefeb4e8dd46764 The lazarus popup error message says: Project Swindow raised exception class 'External: SIGSEGV'. The top of the lazarus call stack shows: #0 : ?? at :0 #1 :08058BC2 SYSTEM_TOBJECT_$__FREE at :0 #2 is my own call: if assigned (f_image) then f_image.free; I broke up the line, and it's crashing on the "then f_image.free" part, rather than on the "if assigned(f_image)" part. Any ideas? Thanks, David ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] crash in tobject.free
Hi! On Thu, 9 Dec 2010 11:42:20 -0800, David Emerson wrote: > I'm encountering a consistent crash, and I'm not sure how to address the > problem. > > using: > - laz 0.9.28.2-8 beta, svn 22277, from debian testing -- a rather outdated > one, > because at this point upgrading lazarus requires updating debian > - fpc 2.4.0-2 [2010/02/20] for i386 > - fpgui commit e01c52a650bfdcce0bb1c8bbceefeb4e8dd46764 > > The lazarus popup error message says: > > Project Swindow raised exception class 'External: SIGSEGV'. > > The top of the lazarus call stack shows: > > #0 : ?? at :0 > #1 :08058BC2 SYSTEM_TOBJECT_$__FREE at :0 > > #2 is my own call: if assigned (f_image) then f_image.free; > > I broke up the line, and it's crashing on the "then f_image.free" part, > rather > than on the "if assigned(f_image)" part. > > Any ideas? Have you initialized f_image? If not, do f_image := nil; and the error will be gone. (Assigned need this to check if the object exists) You could also use if assigned (f_image) then FreeAndNil(f_image); Hope this works! Matthias Klumpp ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Data alignment of records
I can not understand the data alignment of records. I compiled the program PackRecordsDemo, http://www.freepascal.org/docs-html/ref/refsu16.html#x40-470003.3.2 sample documentation. But the result on my computer is different: Size Trec1 : 4 Offset B : 2 Size Trec2 : 3 Offset B : 1 Size Trec3 : 2 Offset B : 1 Size Trec4 : 2 Offset B : 1 Size Trec5 : 5 Offset B : 1 Offset C : 4 //diferent Size Trec6 : 5 Offset B : 1 Offset C : 4 //diferent Size Trec7 : 9 Offset B : 1 Offset C : 8 //diferent Size Trec8 : 9 Offset B : 1 Offset C : 8 //diferent Can someone explain to me, about the alignment of registration data and other variables. My computer is : intel Quad CPU Q6600 S.O. Windows Vista Att. Luis Del Aguila ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Data alignment of records
On 09 Dec 2010, at 22:33, Luis Fernando Del Aguila Mejía wrote: > I can not understand the data alignment of records. > I compiled the program PackRecordsDemo, > http://www.freepascal.org/docs-html/ref/refsu16.html#x40-470003.3.2 sample > documentation. > But the result on my computer is different: > > Size Trec1 : 4 Offset B : 2 > Size Trec2 : 3 Offset B : 1 > Size Trec3 : 2 Offset B : 1 > Size Trec4 : 2 Offset B : 1 > Size Trec5 : 5 Offset B : 1 Offset C : 4 //diferent > Size Trec6 : 5 Offset B : 1 Offset C : 4 //diferent > Size Trec7 : 9 Offset B : 1 Offset C : 8 //diferent > Size Trec8 : 9 Offset B : 1 Offset C : 8 //diferent The output in the manual is wrong (and it should probably use ptrint rather than longint), and probably from a very old FPC version. The output you posted above is the expected output. > Can someone explain to me, about the alignment of registration data and other > variables. The alignment of an array is the same as the alignment of its element types, so for an array of byte that is 1 -> all of the array fields are aligned to 1 byte. I don't know what you mean by "registration data". Jonas___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] crash in tobject.free
Thanks Matthias, FreeAndNil solved my problem! I was assuming that calling Free would also nil out the variable holding the reference to the object, but obviously it does not. Cheers, David On Thu 9 Dec 2010, Matthias Klumpp wrote: > Hi! > On Thu, 9 Dec 2010 11:42:20 -0800, David Emerson > wrote: > > I'm encountering a consistent crash, and I'm not sure how to address the > > > problem. > > > > using: > > - laz 0.9.28.2-8 beta, svn 22277, from debian testing -- a rather > outdated > > one, > > because at this point upgrading lazarus requires updating debian > > - fpc 2.4.0-2 [2010/02/20] for i386 > > - fpgui commit e01c52a650bfdcce0bb1c8bbceefeb4e8dd46764 > > > > The lazarus popup error message says: > > > > Project Swindow raised exception class 'External: SIGSEGV'. > > > > The top of the lazarus call stack shows: > > > > #0 : ?? at :0 > > #1 :08058BC2 SYSTEM_TOBJECT_$__FREE at :0 > > > > #2 is my own call: if assigned (f_image) then f_image.free; > > > > I broke up the line, and it's crashing on the "then f_image.free" part, > > rather > > than on the "if assigned(f_image)" part. > > > > Any ideas? > Have you initialized f_image? If not, do f_image := nil; and the error > will be gone. (Assigned need this to check if the object exists) > You could also use if assigned (f_image) then FreeAndNil(f_image); > Hope this works! > Matthias Klumpp > > > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Looking for SDL_opengl header
On Wed, 2010-12-08 at 23:06 +0100, Michalis Kamburelis wrote: > Darius Blaszyk wrote: > > Has anyone ever converted the SDL_opengl header to FPC? Couldn't find it > > in the repository, but perhaps someone knows if it is part of another > > project. > > > > SDL_opengl.h is just (one of the) cross-platform ways to include OpenGL > stuff in C programs. We don't need it in FPC, just use GL, GLU, GLExt > units as usual. Thanks for the info, just as I figured. Regards, Darius ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Problem with OpenGL drawing on Linux
Hi, In my code I experience a problem with drawing stippled lines with OpenGL. In the following example no line is drawn, but when I change glVertex2f(40, 480); to glVertex2f(640, 480); there is a stippled line drawn. On the other hand, when I comment glEnable(GL_LINE_STIPPLE); then a solid line is draw in both cases. Am I making some subtle mistake in commands, or is there a bug here? I'm using: 2.4.0-2 [2010/03/06] for i386 Regards, Darius program gl_test; {$mode objfpc}{$H+} uses {$IFDEF UNIX} {$IFDEF UseCThreads} cthreads, {$ENDIF} {$ENDIF} GL, GLut; procedure DisplayFunc; cdecl; begin glMatrixMode(GL_PROJECTION); glLoadIdentity; glOrtho(0, 640, 480, 0, 0, 1); glMatrixMode(GL_MODELVIEW); glDisable(GL_DEPTH_TEST); glShadeModel(GL_FLAT); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glClear(GL_COLOR_BUFFER_BIT); glLineWidth(5); glEnable(GL_LINE_STIPPLE); //comment line glLineStipple(1, $0101); glBegin(GL_LINES); glColor3f(1, 0, 0); glVertex2f(0, 0); glVertex2f(40, 480); //change to glVertex2f(640, 480); glEnd; glDisable(GL_LINE_STIPPLE); glutSwapBuffers; end; begin glutInit(@argc, argv); glutInitDisplayMode(GLUT_DOUBLE or GLUT_RGBA); glutInitWindowSize(640, 480); glutInitWindowPosition(100, 100); glutCreateWindow('OpenGL test'); glutDisplayFunc(@DisplayFunc); glClearColor(0, 0, 0, 1); glutMainLoop; end. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Problem with OpenGL drawing on Linux
I can't spot anything inherently wrong here. Try glOrtho with near plane at -1 Otherwise, what kind of graphics driver are you running? Radeon DRI for example? A quick search seems to indicate that that one has a persisting problem with glLineStipple Den 10-12-2010 00:34, Darius Blaszyk skrev: ... ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Is FPC implementing part or most of Delphi 2010's new RTTI?
Dear all, I understand Delphi 2010 has changed its RTTI mechanism, and it is said to be much more usable than the previous one. (see here for example: http://www.malcolmgroves.com/blog/?p=476) What are the FPC team's plans about improving the RTTI? Any similar or as easy to use/powerful? For example, are there any attributes? Best regards, Thierry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal