Bjr à tous,

Soit le code ci-dessous qui affiche un grand plan.
Le problème rencontré est le suivant:
- Si je n'appelle pas la fonction GroupeIsInView() [qui teste si un graphisme est dans la vue], aucune anomalie
- Si je mets un AfficherMessage() [qui affiche un message dans un ListBox situé dans une autre fenêtre flottante], aucun problème
- Je rétablis le test if (GroupeIsInView(MyGroupe) and (MyGroupe.Visible)), et je désactive le AfficherMessage(): freeze
- Je rétablis le test if (GroupeIsInView(MyGroupe) and (MyGroupe.Visible)), et je réactive le AfficherMessage(): aucun problème
- Je place un bloc de protection try/except: Aucun problème mais aucune exception n'est déclenchée puisque la ligne QPointDePassage := 9999; est exécutée dans tous les cas

Etrange ...

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
 
// le dessin de la cavité
        NbGroupes       := FDocumentDessin.GetNbGroupes();
        NbScraps        := FDocumentDessin.GetNbScraps();
        NbCourbes       := FDocumentDessin.GetNbCourbes();
        NbPolyLines     := FDocumentDessin.GetNbPolylignes();
        NbPolygones     := FDocumentDessin.GetNbPolygones();
        NbSimpleLignes  := FDocumentDessin.GetNbSimpleLignes();
        NbSymboles      := FDocumentDessin.GetNbSymboles();
        NbTextes        := FDocumentDessin.GetNbTextes();
        // les images de fond
        if (tedIMAGES in FParamsVue2D.ElementsDrawn) then
        begin
          NbImages := FDocumentDessin.GetNbImages();
          if (NbImages > 0) then
          begin
            for ii := 0 to NbImages - 1 do TmpBuffer.DrawImage(FDocumentDessin.GetImage(ii));
          end;
        end;
        AfficherMessage('Begin drawing');     
 for NumGroupe := 0 to NbGroupes - 1 do
        begin
          FDrwCurrentMode := mseNONE;
          MyGroupe := FDocumentDessin.GetGroupe(NumGroupe);
          // tracer le BBX du groupe
          // on teste si le groupe est partiellement visible dans la fenêtre
          // avant de le tracer (forte accélération du dessin)
          if (GroupeIsInView(MyGroupe) and (MyGroupe.Visible)) then
          begin
            // Bug du compilateur suspecté +++
            // Symptômes: Freeze au redessin
            // Reproductible: Oui
            // Systématique : Oui
            // Particularités:
            // 1. Si un appel de AfficherMessage() est effectué, le bug ne se produit pas, même avec un appel indirect via la fonction thurlutte()
            // 2. Si la fonction thurlutte() ne contient pas un appel à AfficherMessage(), le bug se produit
            // 3. Si un block de protection est installé, le bug ne se produit pas
            //    Toutefois, aucune erreur n'est interceptée (le programme passe par la ligne QPointDePassage := 9999;)
            //thurlutte(); // Fonction alternative au block de protection
            try
              // les scraps sont tracés dans tous les cas
              FDrwCurrentMode := mseSCRAPS;
              QPointDePassage := 1000;
              if (NbScraps > 0) then
              begin
                for ii:=0 to NbScraps - 1 do
                begin
                  FDrwCurrentIdxObj := ii;
                  if (MyGroupe.Visible) then TmpBuffer.DessinerScrap(FDocumentDessin.GetScrap(ii), ii, False, MyGroupe.IDGroupeEntites);
                end;
              end;
              FDrwCurrentMode := msePOLYGONES;
              QPointDePassage := 2000;
              if ((NbPolygones > 0) and (FEtendueXY < SEUIL_VISIBILITE_POLYGONES)) then
              begin
                for ii:=0 to NbPolygones - 1 do
                begin
                  FDrwCurrentIdxObj := ii;
                  if (MyGroupe.Visible) then TmpBuffer.DessinerPolygone(FDocumentDessin.GetPolygone(ii), ii, False, MyGroupe.IDGroupeEntites);
                end;
              end;
              // désactivation de la texture: les objets suivants n'ont pas de texture
              TmpBuffer.CanvasBGRA.Brush.Texture := nil;
              FDrwCurrentMode := mseCOURBES;
              QPointDePassage := 3000;
              if ((NbCourbes > 0) and (FEtendueXY < SEUIL_VISIBILITE_COURBES_POLYLIGNES)) then
              begin
                for ii:=0 to NbCourbes - 1 do
                begin
                  FDrwCurrentIdxObj := ii;
                  if (MyGroupe.Visible) then TmpBuffer.DessinerCourbe(FDocumentDessin.GetCourbe(ii), ii, MyGroupe.IDGroupeEntites);
                end;
              end;
              FDrwCurrentMode := msePOLYLIGNES;
              QPointDePassage := 4000;
              if ((NbPolyLines > 0) and (FEtendueXY < SEUIL_VISIBILITE_COURBES_POLYLIGNES))then
              begin
                for ii:=0 to NbPolyLines - 1 do
                begin
                  FDrwCurrentIdxObj := ii;
                  if (MyGroupe.Visible) then TmpBuffer.DessinerPolyLigne(FDocumentDessin.GetPolyligne(ii), ii, MyGroupe.IDGroupeEntites);
                end;
              end;
              FDrwCurrentMode := mseLIGNES;
              QPointDePassage := 5000;
              if ((NbSimpleLignes > 0) and (FEtendueXY < SEUIL_VISIBILITE_SIMPLES_LIGNES)) then
              begin
                for ii := 0 to NbSimpleLignes - 1 do
                begin
                  FDrwCurrentIdxObj := ii;
                  if (MyGroupe.Visible) then TmpBuffer.DessinerSimpleLigne(FDocumentDessin.GetSimpleLigne(ii), false, MyGroupe.IDGroupeEntites);
                end;
              end;
              QPointDePassage := 9999; // le programme passe ici !
            except // fin de la zone de sécurisation indispensable !!!
              Result := -QPointDePassage;
            end;
          end;
          // Symboles et textes: Pas la peine de tester les BBX (ces objets sont relativement rares)
          FDrwCurrentMode := mseSYMBOLES;
          if ((NbSymboles > 0) and (FEtendueXY < SEUIL_VISIBILITE_SYMBOLES)) then   // Symboles OK
          begin
            for ii := 0 to NbSymboles - 1 do
            begin
              FDrwCurrentIdxObj := ii;
              if (MyGroupe.Visible) then TmpBuffer.DessinerSymbole(FDocumentDessin.GetSymbole(ii), MyGroupe.IDGroupeEntites);
            end;
          end;
          FDrwCurrentMode := mseTEXTES;
          if ((tedTEXTES in FParamsVue2D.ElementsDrawn) and (NbTextes > 0) and (FEtendueXY < SEUIL_VISIBILITE_TEXTES)) then
          begin
            for ii := 0 to NbTextes - 1 do
            begin
              FDrwCurrentIdxObj := ii;
              if (MyGroupe.Visible) then TmpBuffer.DessinerTexte(FDocumentDessin.GetTexte(ii), False, MyGroupe.IDGroupeEntites);
            end;
          end;
        end; // for NoGroupe ...
        //************************