Running GetStrings on a memini results in segfault lazarus / 61-Beginners ---------------------------------------------------------------------- hgdagon · 2020-06-05 21:37 Here's my code so far: 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 unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, IniFiles, stdctrls; type   { TForm1 }   TForm1 = class(TForm)    procedure FormCreate(Sender: TObject);  private   public   end; var  Form1: TForm1;  INI: TMemIniFile;  Sections,KeyValues,Keys,Values,Descs: TStringList;  iiS,iiKV,iiK,iiV: Integer;  Sectionbox,KeyCaption,ValueCaption,DescCation: TList;  KeyLabel: TLabel;  GroupBox: TGroupBox;  ContainBox: TScrollBox;  Message: String; implementation {$R *.lfm} { TForm1 } procedure LoadiniToGraph(Owner: TWinControl);begin  INI := TMemIniFile.Create('settings.ini');  Sections:=TStringList.Create;  KeyValues:=TStringList.Create;  Keys:=TStringList.Create;  Values:=TStringList.Create;  Sectionbox:=TList.Create;  KeyCaption:=TList.Create;  INI.GetStrings(Descs);                        //<-- Segfaults hereend; procedure TForm1.FormCreate(Sender: TObject);begin  LoadiniToGraph(Form1);end; end. As you can see, I'm not doing much yet, just reading the lines into a stringlist. What could be the cause of the segfault? ---------------------------------------------------------------------- hgdagon · 2020-06-05 21:43 Sorry, I can't delete the topic, but I see it now, it's right there. Of course, it segfaults. ---------------------------------------------------------------------- jamie · 2020-06-05 21:46 Yup, usually living on a house that isn't built yet may yield some unpredictable living conditions! ---------------------------------------------------------------------- Remy Lebeau · 2020-06-09 00:22 Quote from: hgdagon on June 05, 2020, 11:37:21 pmCode: [Select]procedure LoadiniToGraph(Owner: TWinControl); begin   INI := TMemIniFile.Create('settings.ini');   ...   INI.GetStrings(Descs);                          //<-- Segfaults here end; That is because LoadiniToGraph() is not assigning a valid TStringList object to the Descs variable before passing it to GetStrings(). Code: [Select]procedure LoadiniToGraph(Owner: TWinControl); begin   INI := TMemIniFile.Create('settings.ini');   ...   Descs := TStringList.Create; // <-- add this!   ...   INI.GetStrings(Descs); end;