Bonjour à tous,

Je rencontre depuis hier un Segmentation Fault (11) lors de la compilation sur mon appareil Android. Or lorsque je lance mon programme sous Win32 tout marche à marveille. Je n'arrive pas à trouver la ligne où sa plante, j'ai regarder toute mes boucles, je ne trouve pas. Donc je viens demander un petit coup de pouce à une main experte

Je vous laisse donc mon code ci dessous :
Unit Main :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
unit uMain;
 
interface
 
uses
{$IF DEFINED(ANDROID)}
  Androidapi.JNI.JavaTypes, FMX.Helpers.Android,
  Androidapi.JNI.GraphicsContentViewText,
  Androidapi.JNIBridge, Androidapi.Helpers,
{$ENDIF}
  System.SysUtils, System.Types, System.UITypes, System.Classes,
  System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls,
  FMX.Controls.Presentation, FMX.Edit, FMX.Objects,
  Generics.Collections,
 
  DatabaseHelper, Data.sqlexpr, Data.DbxSqlite, Data.DB, FMX.Menus, FMX.ListBox,
  FMX.Layouts,
 
  uIdentification;
 
type
  TFormMain = class(TForm)
    ToolBar: TToolBar;
    BTN_ToDo: TButton;
    VSBMain: TVertScrollBox;
 
    procedure FormShow(Sender: TObject);
    procedure OnVSBMainResize(Sender: TObject);
    procedure FormCreate(Sender: TObject);
 
  private
    F_sNomPackageAndroid, F_sCheminBddWindows: String;
    LBLList: TList<TLabel>;
    uIdentification : TFormIdentification;
 
    procedure AffBdd;
 
  public
    procedure resultIsLogged(sValue: String);
 
end;
 
var
  FormMain: TFormMain;
 
implementation
 
{$R *.fmx}
 
procedure TFormMain.FormCreate(Sender: TObject);
  {$IF DEFINED(ANDROID)}
  Var
    PackageManager: JPackageManager;
    PackageInfo: JPackageInfo;
  {$ENDIF}
begin
  { Initialisation vers les dossiers des bases de données Android et Windows }
  F_sNomPackageAndroid := '';
  F_sCheminBddWindows := '.\bdd\';
  { Pour Android, on récupère le nom du package qui est utilisé par Android pour le chemin de l'application }
  {$IF DEFINED(ANDROID)}
    PackageManager := SharedActivity.getPackageManager;
    PackageInfo := PackageManager.getPackageInfo(SharedActivityContext.getPackageName(), TJPackageManager.JavaClass.GET_ACTIVITIES);
    F_sNomPackageAndroid := JStringToString(PackageInfo.packageName);
    { sImgPath := '/data/data/' + F_sNomPackageAndroid + '/files/'; }
  {$ELSE}
    { sImgPath := '../../pictures/'; }
  {$ENDIF}
  LBLList := TList<TLabel>.Create;
end;
 
procedure TFormMain.FormShow(Sender: TObject);
begin
  uIdentification := TFormIdentification.Create(Self);
  uIdentification.Logged := resultIsLogged;
  {$IF DEFINED(ANDROID)}
    uIdentification.Show;
  {$ELSE}
    uIdentification.ShowModal;
  {$ENDIF}
end;
 
procedure TFormMain.AffBdd;
Var
  ConnexionBdd: TDbHelper;
  SelectQuery: TSQLQuery;
  I: Integer;
  LBL: TLabel;
Begin
  ConnexionBdd := TDbHelper.Create(F_sNomPackageAndroid, F_sCheminBddWindows, 'Test.3db');
  SelectQuery := TSQLQuery.Create(nil);
 
  I := 0;
  while I < LBLList.Count do
  Begin
    If LBLList.Items[I] <> nil then
    begin
      LBLList.Items[I].DisposeOf;
    End;
    Inc(I);
  End;
 
  With SelectQuery Do
  Begin
    SQLConnection := ConnexionBdd.GetConnection;
    Active := false;
    SQL.Text := 'SELECT Imputation1 FROM DCommand WHERE (Cle >= 20130657 AND Cle <= 20130668);';
    Open;
    First;
    I := 0;
    While Not EOF Do
    Begin
        LBL := TLabel.Create(VSBMain);
        LBL.Parent := VSBMain as TFmxObject;
        LBL.Text := SelectQuery['Imputation1'];
        LBL.Height := 30;
        LBL.StyledSettings := LBL.StyledSettings - [TStyledSetting.Size];
        LBL.Font.Size := 9;
        LBL.Position.X := (Round(VSBMain.Width / 4) - LBL.Width - (1.1 * LBL.Width));
        LBL.Position.Y := (Round(VSBMain.Height / 20) + I * LBL.Height + 20);
        LBL.Align := TAlignLayout.Top;
        LBLList.Add(LBL);
        Inc(I);
        Next;
    End;
    Close;
    DisposeOf;
  End;
  ConnexionBdd.Close;
End;
 
procedure TFormMain.OnVSBMainResize(Sender: TObject);
Var
  I: Integer;
Begin
  I := 0;
  While I < LBLList.Count Do
  begin
    If LBLList.Items[I] <> nil Then
      LBLList.Items[I].Position.X := (Round(VSBMain.Width / 4) - LBLList.Items[I].Width);
    Inc(I);
  end;
End;
 
procedure TFormMain.resultIsLogged(sValue: String);
Begin
  If sValue = 'REPEAT' Then
  Begin
    uIdentification.Show;
  End
  Else if sValue = 'OK' then
  Begin
    uIdentification.Close;
    AffBdd;
  End
  Else
  Begin
    uIdentification.Close;
    Application.Terminate;
  End;
End;
 
end.
Unit Identification :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
unit uIdentification;
 
interface
 
uses
  {$IF DEFINED(ANDROID)}
    Androidapi.JNI.JavaTypes , FMX.Helpers.Android , ANdroidapi.JNI.GraphicsContentViewText ,
    Androidapi.JNIBridge , Androidapi.Helpers ,
  {$ENDIF}
 
  System.SysUtils , System.Types , System.UITypes , System.Classes , System.Variants ,
  FMX.Types , FMX.Controls , FMX.Forms , FMX.Graphics , FMX.Dialogs , FMX.StdCtrls ,
  FMX.Controls.Presentation, FMX.Edit, FMX.Objects,
 
  DatabaseHelper , Data.sqlexpr , Data.DbxSqlite , Data.DB , FMX.Menus , FMX.ListBox ,
  FMX.Layouts;
 
type
  TLogged = procedure(sIsLogged : String) Of Object;
 
  TFormIdentification = class(TForm)
    LBL_Login: TLabel;
    LBL_Mdp: TLabel;
    CBB_Login: TComboBox;
    BTN_Connexion: TButton;
    BTN_Annulee: TButton;
    Edit_Mdp: TEdit;
    procedure BTN_ConnexionClick(Sender: TObject);
    procedure OnFormIdentificationCreate(Sender: TObject);
    procedure OnFormIdentificationResize(Sender: TObject);
    procedure BTN_AnnuleeClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    F_sNomPackageAndroid , F_sCheminBddWindows : String;
  public
    Logged : TLogged;
  end;
 
var
  FormIdentification: TFormIdentification;
 
implementation
 
{$R *.fmx}
 
procedure TFormIdentification.BTN_AnnuleeClick(Sender: TObject);
begin
  Logged('STOP');
end;
 
procedure TFormIdentification.BTN_ConnexionClick(Sender: TObject);
Var
  ConnexionBdd : TDbHelper;
  SelectQuery : TSQLQuery;
Begin
  If CBB_Login.Selected = nil Then
    Exit;
 
  ConnexionBdd := TDbHelper.Create(F_sNomPackageAndroid , F_sCheminBddWindows , 'Test.3db');
  SelectQuery := TSQLQuery.Create(nil);
 
  With SelectQuery Do
  Begin
    SQLConnection := ConnexionBdd.GetConnection;
    Active := false;
    SQL.Text := 'SELECT login, mdp FROM users WHERE login=:pLogin;';
    ParamByName('pLogin').AsString := CBB_Login.Selected.Text;
    //ParamByName('pMdp').AsString := Edit_Mdp.Text;
    Open;
    First;
    if Not EOF Then
    Begin
      Logged('OK');
    Next;
    End
    Else
    Begin
      Logged('REPEAT');
    End;
 
    Close;
    DisposeOf;
  End;
  ConnexionBdd.Close;
End;
 
procedure TFormIdentification.FormShow(Sender: TObject);
Var
  ConnexionBdd : TDbHelper;
  SelectQuery : TSQLQuery;
Begin
  ConnexionBdd := TDbHelper.Create(F_sNomPackageAndroid , F_sCheminBddWindows , 'Test.3db');
  SelectQuery := TSQLQuery.Create(nil);
 
  With SelectQuery Do
  Begin
    SQLConnection := ConnexionBdd.GetConnection;
    Active := false;
    SQL.Text := 'SELECT login FROM users;';
 
    Open;
    First;
    While Not EOF Do
    Begin
      CBB_Login.Items.Add(SelectQuery['login']);
      Next;
    End;
    Close;
    DisposeOf;
 
  End;
  ConnexionBdd.Close;
end;
 
procedure TFormIdentification.OnFormIdentificationCreate(Sender: TObject);
  {$IF DEFINED(ANDROID)}
  Var
    PackageManager : JPackageManager;
    PackageInfo : JPackageInfo;
  {$ENDIF}
Begin
  { Initialisation vers les dossiers des bases de données Android et Windows }
    F_sNomPackageAndroid := '';
    F_sCheminBddWindows := '.\bdd\';
  { Pour Android, on récupère le nom du package qui est utilisé par Android pour le chemin de l'application }
  {$IF DEFINED(ANDROID)}
    PackageManager := SharedActivity.getPackageManager;
    PackageInfo := PackageManager.getPackageInfo(SharedActivityContext.getPackageName() , TJPackageManager.JavaClass.GET_ACTIVITIES);
    F_sNomPackageAndroid := JStringToString(PackageInfo.packageName);
    { sImgPath := '/data/data/' + F_sNomPackageAndroid + '/files/'; }
  {$ELSE}
    { sImgPath := '../../pictures/'; }
  {$ENDIF}
End;
 
procedure TFormIdentification.OnFormIdentificationResize(Sender: TObject);
Begin
  LBL_Login.Width := Round(Self.Width / 2.5);
  LBL_Mdp.Width := Round(Self.Width / 2.5);
  CBB_Login.Width := Round(Self.Width / 2.5);
  Edit_Mdp.Width := Round(Self.Width / 2.5);
  BTN_Connexion.Width := Round(Self.Width / 6);
  BTN_Annulee.Width := Round(Self.Width / 6);
 
  LBL_Login.Position.X := Round(((Self.Width - LBL_Login.Width) / 2) - (LBL_Login.Width / 3));
  CBB_Login.Position.X := Round(((Self.Width - CBB_Login.Width) / 2) + (CBB_Login.Width / 3));
  LBL_Mdp.Position.X := Round(((Self.Width - LBL_Mdp.Width) / 2) - (LBL_Mdp.Width / 3));
  Edit_Mdp.Position.X := Round(((Self.Width - Edit_Mdp.Width) / 2) + (Edit_Mdp.Width / 3));
  BTN_Connexion.Position.X := Round(((Self.Width - BTN_Connexion.Width) / 2) - BTN_Connexion.Width);
  BTN_Annulee.Position.X := Round(((Self.Width - BTN_Annulee.Width) / 2) + BTN_Annulee.Width);
 
  LBL_Login.Position.Y := Round((Self.Height - LBL_Login.Height) / 2) - LBL_Login.Height * 2 - 50;
  LBL_Mdp.Position.Y := Round((Self.Height - LBL_Mdp.Height) / 2) + LBL_Login.Height * 2 - 50;
  CBB_Login.Position.Y := Round((Self.Height - CBB_Login.Height) / 2) - LBL_Login.Height * 2 - 50;
  Edit_Mdp.Position.Y := Round((Self.Height - Edit_Mdp.Height) / 2) + LBL_Login.Height * 2 - 50;
  BTN_Connexion.Position.Y := Round((Self.Height - BTN_Connexion.Height) / 2) + BTN_Connexion.Height * 3;
  BTN_Annulee.Position.Y := Round((Self.Height - BTN_Annulee.Height) / 2) + BTN_Annulee.Height * 3;
End;
 
end.
En gros, l'unité Main appel directement l'unité Identification via un Show, si le client s'est bien identifié alors on le redirige vers l'unité main où une table de ma bdd sera affiché via des TLabel. Rien de plus.
Le problème c'est que le compilateur ne me dit rien de spécial, ne me précise aucune ligne particulière où regarder, donc un peu perdu .. Si quelqu'un arrive à me trouver une solution, je lui paye un bonbon !

Allé, sur ce, bonne journée de la Hautes Savoie, en remerciant d'avance les âmes charitables !

Bien Cordialement,