Have you tryed to compile using an older widget-lcl library?

If youre using gnome, try to compile it for kde, and viceversa.

Or make a downgrade to something-older-that-works.

Compiling your software on a machine that never changes, however, is a good choice to avoid this problems. I often use virtual machines that i never power on to compile very important binaries for my softwares.
Hello All

I am having a very strange problem with my Artificial Chemistry simulator, SimSoup, which uses Lazarus for the user interface.

I think that the problem could be a data corruption during Lazarus / Free Pascal initialisation.

The program has been running fine for a couple of years, but I have recently upgraded to SUSE 10.1 and Lazarus 0.9.20 beta, and now it often crashes on startup, and when it does run, the simulation statistics display (a Bitmap painted on a TPaintPox) is offset to the right by about 200 pixels, although it rights itself if I leave the tab that contains the display and then return to it.

I have included below output from running Valgrind on the program, and highlighted what look like the first and second signs of trouble.

In both cases, there seems to be a call to FPC_INITIALIZEUNITS. The call is made from P$SIMSOUP_LAZ_GUI_PRESENT_main. I think that this must be a compiler generated entry in my SIMSOUP_LAZ_GUI_PRESENT library. The line number mentioned (303) is actually the last line in the source file for the library. I think that P$SIMSOUP_LAZ_GUI_PRESENT_main is being called before any of my own code runs (eg in the 'second sign of trouble' it is called as a result of the invokation of _dl_init (in /lib/ld-2.4.so). I suppose that this is being invoked when the shared object that implements the library is loaded.

The overall structure of the simulator is that the main logic runs in a C++ program. The very first thing the C++ main program does is to call the Free Pascal SimSoup_Lazarus function (see below) in the SIMSOUP_LAZ_GUI_PRESENT library, using the 'C' calling interface. The problem occurs before execution gets into SimSoup_Lazarus.

Any help on this will be much appreciated. I've been struggling with this for a couple of weeks now and not getting very far.

Here is the SimSoup_Lazarus function:-

function  SimSoup_Lazarus(): Integer;  cdecl;
begin
  writeln('Entered Stop SimSoup_Lazarus');
  Application.Initialize;
  Application.CreateForm(TMainForm, Main_Form);
  Application.Run;
  SimSoup_Lazarus := 0;
end;

Here is the Valgrind output:-

==7948== Memcheck, a memory error detector.
==7948== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==7948== Using LibVEX rev 1575, a library for dynamic binary translation.
==7948== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==7948== Using valgrind-3.1.1, a dynamic binary instrumentation framework.
==7948== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==7948== For more details, rerun with: -v
==7948== ==7948== My PID = 7948, parent PID = 7925. Prog and args are:
==7948==    ./SimSoup
==7948== ==7948== Invalid read of size 4 ==7948== at 0x4330814: SYSTEM_TRY_CONCAT_FREE_CHUNK$PMEMCHUNK_VAR$$PMEMCHUNK_VAR (in /home/chris/mydata/Projects/SimSoup/simsoup-cpp/simsoup/debug/libsimsoup_laz_gui_present.so) ==7948== by 0x4330E1A: SYSTEM_SYSFREEMEM_VAR$PMEMCHUNK_VAR$$LONGINT (in /home/chris/mydata/Projects/SimSoup/simsoup-cpp/simsoup/debug/libsimsoup_laz_gui_present.so) ==7948== by 0x4330E6E: SYSTEM_SYSFREEMEM$POINTER$$LONGINT (in /home/chris/mydata/Projects/SimSoup/simsoup-cpp/simsoup/debug/libsimsoup_laz_gui_present.so) ==7948== by 0x433008F: SYSTEM_FREEMEM$POINTER$$LONGINT (in /home/chris/mydata/Projects/SimSoup/simsoup-cpp/simsoup/debug/libsimsoup_laz_gui_present.so) ==7948== by 0x43213DA: fpc_ansistr_decr_ref (in /home/chris/mydata/Projects/SimSoup/simsoup-cpp/simsoup/debug/libsimsoup_laz_gui_present.so) ==7948== by 0x433FFF9: CLASSES_TSTRINGLIST_$__FIND$ANSISTRING$LONGINT$$BOOLEAN (in /home/chris/mydata/Projects/SimSoup/simsoup-cpp/simsoup/debug/libsimsoup_laz_gui_present.so) ==7948== by 0x4340084: CLASSES_TSTRINGLIST_$__INDEXOF$ANSISTRING$$LONGINT (in /home/chris/mydata/Projects/SimSoup/simsoup-cpp/simsoup/debug/libsimsoup_laz_gui_present.so) ==7948== by 0x447D6FA: WSLCLCLASSES_REGISTERWSCOMPONENT$TCOMPONENTCLASS$TWSLCLCOMPONENTCLASS$TWSPRIVATECLASS_GETNODE$TCLASS$$PCLASSNODE (wslclclasses.pp:163) ==7948== by 0x447D03C: WSLCLCLASSES_REGISTERWSCOMPONENT$TCOMPONENTCLASS$TWSLCLCOMPONENTCLASS$TWSPRIVATECLASS (in /home/chris/mydata/Projects/SimSoup/simsoup-cpp/simsoup/debug/libsimsoup_laz_gui_present.so)
==7948==    by 0x44A54F2: GTKWSCONTROLS_init (gtkwscontrols.pp:931)

*****  FIRST SIGN OF TROUBLE  *****
==7948== by 0x432DF88: fpc_initializeunits (in /home/chris/mydata/Projects/SimSoup/simsoup-cpp/simsoup/debug/libsimsoup_laz_gui_present.so) ==7948== by 0x431F6F3: P$SIMSOUP_LAZ_GUI_PRESENT_main (simsoup_laz_gui_present.pp:303)
==7948==  Address 0x97EAE4FC is not stack'd, malloc'd or (recently) free'd
==7948== ==7948== Invalid read of size 4
***************

==7948==    at 0x441172D: LCLINTF_GETCAPTURE$$HWND (winapi.inc:280)
==7948== by 0x4358A3E: FORMS_TAPPLICATION_$__HANDLEEXCEPTION$TOBJECT (application.inc:874)
==7948==    by 0x434EB1B: ??? (forms.pp:1334)
==7948== by 0x432AE6B: SYSTEM_DOUNHANDLEDEXCEPTION (in /home/chris/mydata/Projects/SimSoup/simsoup-cpp/simsoup/debug/libsimsoup_laz_gui_present.so) ==7948== by 0x432B277: fpc_reraise (in /home/chris/mydata/Projects/SimSoup/simsoup-cpp/simsoup/debug/libsimsoup_laz_gui_present.so) ==7948== by 0x447D0D2: WSLCLCLASSES_REGISTERWSCOMPONENT$TCOMPONENTCLASS$TWSLCLCOMPONENTCLASS$TWSPRIVATECLASS (in /home/chris/mydata/Projects/SimSoup/simsoup-cpp/simsoup/debug/libsimsoup_laz_gui_present.so)
==7948==    by 0x44A54F2: GTKWSCONTROLS_init (gtkwscontrols.pp:931)


*****  SECOND SIGN OF TROUBLE  *****
==7948== by 0x432DF88: fpc_initializeunits (in /home/chris/mydata/Projects/SimSoup/simsoup-cpp/simsoup/debug/libsimsoup_laz_gui_present.so) ==7948== by 0x431F6F3: P$SIMSOUP_LAZ_GUI_PRESENT_main (simsoup_laz_gui_present.pp:303) ==7948== by 0x431E2AE: (within /home/chris/mydata/Projects/SimSoup/simsoup-cpp/simsoup/debug/libsimsoup_laz_gui_present.so)
==7948==    by 0x400D762: call_init (in /lib/ld-2.4.so)
==7948==    by 0x400D872: _dl_init (in /lib/ld-2.4.so)
==7948==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==7948== ==7948== Invalid read of size 4
************************************

==7948== at 0x4329DE0: SYSTEM_TOBJECT_$__FREE (in /home/chris/mydata/Projects/SimSoup/simsoup-cpp/simsoup/debug/libsimsoup_laz_gui_present.so) ==7948== by 0x4424A93: LRESOURCES_TLRESOURCELIST_$__DESTROY (lresources.pp:1110) ==7948== by 0x4329DE4: SYSTEM_TOBJECT_$__FREE (in /home/chris/mydata/Projects/SimSoup/simsoup-cpp/simsoup/debug/libsimsoup_laz_gui_present.so)
==7948==    by 0x442D578: LRESOURCES_finalize (lresources.pp:4323)
==7948== by 0x432DFD2: SYSTEM_FINALIZEUNITS (in /home/chris/mydata/Projects/SimSoup/simsoup-cpp/simsoup/debug/libsimsoup_laz_gui_present.so) ==7948== by 0x432E041: SYSTEM_INTERNALEXIT (in /home/chris/mydata/Projects/SimSoup/simsoup-cpp/simsoup/debug/libsimsoup_laz_gui_present.so) ==7948== by 0x432E283: SYSTEM_DO_EXIT (in /home/chris/mydata/Projects/SimSoup/simsoup-cpp/simsoup/debug/libsimsoup_laz_gui_present.so) ==7948== by 0x432E2B4: SYSTEM_HALT$BYTE (in /home/chris/mydata/Projects/SimSoup/simsoup-cpp/simsoup/debug/libsimsoup_laz_gui_present.so)
==7948==    by 0x434E9F3: ??? (forms.pp:1320)
==7948== by 0x432AE6B: SYSTEM_DOUNHANDLEDEXCEPTION (in /home/chris/mydata/Projects/SimSoup/simsoup-cpp/simsoup/debug/libsimsoup_laz_gui_present.so) ==7948== by 0x432B277: fpc_reraise (in /home/chris/mydata/Projects/SimSoup/simsoup-cpp/simsoup/debug/libsimsoup_laz_gui_present.so)
==7948==    by 0x434EB40: ??? (forms.pp:1318)
==7948==  Address 0x51 is not stack'd, malloc'd or (recently) free'd
==7948== ==7948== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 5 from 1)
==7948== malloc/free: in use at exit: 0 bytes in 0 blocks.
==7948== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
==7948== For counts of detected errors, rerun with: -v
==7948== All heap blocks were freed -- no leaks are possible.

Chris Gordon-Smith
www.simsoup.info

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives



_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to