SIGSEGV Exception with TSaveDialog lazarus / 31-LCL ---------------------------------------------------------------------- greertr · 2016-06-07 22:46 I'm using a second form that links back to the mainmenu on the first form. on the second form, I'm using a grid with a save capability (tsavedialog) Code extracts follow: type...  procedure SaveButtonClick(Sender: TObject); implementation... procedure TForm2.SaveButtonClick(Sender: TObject); begin   if SaveDialog1.Execute then     grid.SaveToFile(SaveDialog1.FileName); end;  It was working fine, and out of the blue, it started generating a SIGSEGV exception when i hit enter after entering the filename. I set the debugger to reset each run, but thats all i know to do...any ideas? thx in adv greertr ---------------------------------------------------------------------- fpcoder · 2016-06-08 02:38 SIGSEGV usually means that you try to use a variable that is not yet created, or Free has been called too early. Set a breakpoint somewhere and find out on what line it happens. If your program is not too big, zip it up and upload it here and we can have a look. Only the files *.lpi, *.lpr, *.lfm, *.pas should be uploaded. You can use the Project -> Publish Project feature to make a copy of these sources automatically. ---------------------------------------------------------------------- Thaddy · 2016-06-08 09:09 Furthermore, I would look at the grid first.  Only then I would look at the savedialog. ---------------------------------------------------------------------- greertr · 2016-06-08 11:54 The exceptions is trhown at line 117... grid.SaveToFile(SaveDialog1.FileName); ---------------------------------------------------------------------- howardpc · 2016-06-08 12:05 As Thaddy suggests, something is wrong with "grid" (it is nil or otherwise invalid). Without seeing the full code of your project that tries to create "grid", no one can diagnose precisely what that wrongness might be. ---------------------------------------------------------------------- Thaddy · 2016-06-08 15:51 try this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   if SaveDialog1.Execute then    if Assigned(Grid) then       grid.SaveToFile(SaveDialog1.FileName);  Or - what I prefer since it covers the assertion only while debugging.: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   Assert(Assigned(Grid),'Something wrong with the Grid.')  // requires {$ASSERTIONS ON} remove that if the code is stable into {$ASSERTIONS OFF} if you like.  if SaveDialog1.Execute then    grid.SaveToFile(SaveDialog1.FileName); ---------------------------------------------------------------------- Thaddy · 2016-06-08 16:00 The other two obvious options are: - Illegal filename - Saving to a location without write access rights . e.g. under windows 10 you can not save to the root of the partition that contains the OS (Mostly c:\) without sufficient rights. ---------------------------------------------------------------------- greertr · 2016-06-08 20:46 I finally solved this issue by starting over and copying the grids spreadsheet example and modifying it to suit my needs, it works fine now, and I'll just add forms and redevelop the rest of the program around the spreadsheet using additional forms- kinda backwards, but it will work.