Welcome, Guest
Username: Password: Remember me
CodeTyphon MS Windows (Win7, Win8.x, Win10 and Win11) OS Development, discussions and problems
  • Page:
  • 1

TOPIC:

Issue with QR Code Gen 3 years 5 days ago #16001

  • Robert Jenkins
  • Robert Jenkins's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 15
  • Thank you received: 0
I have been using the package "QRCodeGenLib4Pascal" for a while with CodeTypon and I recently upgraded to CodeTyphon Studio 7.5.  A few days after upgrading I opened up a project that had been working in CodeTyphon Studio 7.4 and got an error.  This was working on 7.4 and earlier. 


Here is a very short example which should recreate the error.


(*

Required Package "pl_QrCodeGen"  or you can get latest source
  and create your own package from github.com/Xor-el/QRCodeGenLib4Pascal
I think pl_QrCodeGen is currently using most recent code from GitHub so you don't need
to git the package.  Just use the package, "pl_QrCodeGen" which is provided with CodeTyhon.

Uses
  QlpIQrCode,
  QlpQrCode;
*)



Procedure Tform1.ButtonGoClick(Sender: TObject);
Var
  LQrCode:    IQrCode;
  LErrCorLvl: TQRCode.TEcc;
  LText:      String;
Begin
  LText := 'Hello, World!!';
  LErrCorLvl := TQrCode.TEcc.eccMedium;

  // For LErrCorLvl := Low(TQrCode.TEcc) To High(TQRCode.TEcc) Do
  Try
   //  the code below creates an "Access Violation" but it worked fine in CodeTypon Studio 7.4
    LQrCode := TQrCode.EncodeText(LText, LErrCorLvl, TEncoding.UTF8);
  Except
    On E: Exception Do
    Begin
      ShowMessage(E.Message);
    End;
  End;
End;


 

Please Log in or Create an account to join the conversation.

Issue with QR Code Gen 3 years 5 days ago #16002

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4504
  • Thank you received: 1100
Thanks Sir
give us time to test and report
PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

Issue with QR Code Gen 3 years 5 days ago #16003

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4504
  • Thank you received: 1100
Please, test the new pl_QRCodeGen
Work OK for us with your sample code and CodeOcean QRCodeGen demo.


.
PilotLogic Architect and Core Programmer
Attachments:

Please Log in or Create an account to join the conversation.

Issue with QR Code Gen 3 years 4 days ago #16004

  • Robert Jenkins
  • Robert Jenkins's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 15
  • Thank you received: 0
I compiled the PL QrCode sample and got the same error.

C:\codetyphon\CodeOcean\pl_QRCodeGen\samples\xbin>QrCodeGeneratorDemo.exe
Started "DoBasicDemo"
EAccessViolation: Access violation

I also copied the EXE to a second computer also running Windows 10 x64 with all the latest patches and updates applied and got the same error. Wonder if I should reinstall CodeTyphon and try again.

Any suggestions of things to try on this end?

Everything else seems to be working fine so far.

Robert

Please Log in or Create an account to join the conversation.

Issue with QR Code Gen 3 years 4 days ago #16005

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4504
  • Thank you received: 1100
Final Fix

The problem is in FreePascal
file: fpcsrc\compiler\x86\aoptx86.pas

function TX86AsmOptimizer.OptPass1Jcc(var p : tai) : boolean;
produce "bad" code for our case pl_QRCodeGen library.

1) Replace C:\codetyphon\fpcsrc\compiler\x86\aoptx86.pas
with the new one from 7z attach file.
OR
put the attach file in to 7z file
C:\codetyphon\allzips\src\fpc_src.7z
(fpcsrc\compiler\x86\)

2) Rebuild FPC and Typhon IDE
PilotLogic Architect and Core Programmer
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: by Sternas Stefanos.

Issue with QR Code Gen 3 years 4 days ago #16006

  • Robert Jenkins
  • Robert Jenkins's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 15
  • Thank you received: 0
I traced through the code with the debugger and eventually got to this:

Error: Project project1 raised exception class 'External: SIGSEGV'.

 In file 'source\QRCodeGen\QlpQrCode.pas' at line 709:
Result := Result + FinderPenaltyCountPatterns(LRunHistory) *

So I modified the code just to try and test some things.  Here is what I changed it to

     (* 
         if (LRunColor = 0) then
         begin
           Result := Result + FinderPenaltyCountPatterns(LRunHistory) *
             PENALTY_N3;
         end;
         *)

        if (LRunColor = 0) then
        Try
          Result := Result + FinderPenaltyCountPatterns(LRunHistory) *
          PENALTY_N3;
        Except
          ON E: Exception Do
          Begin
            System.Inc(Result);  // not sure what problems this will cause...
            E.Create(E.Message);
          End;
        End;


The code is now appears to be working with no errors.  I generated a bunch of QR Codes and had another program read them and they were correct.  Strange, I thought it would still hit and throw the exception but it never does now.  Must be something strange going on with my computer.

Robert








 

Please Log in or Create an account to join the conversation.

Issue with QR Code Gen 3 years 4 days ago #16007

  • Robert Jenkins
  • Robert Jenkins's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 15
  • Thank you received: 0
Did as you said, replaced the file in the FPC source directory and rebuilt FPC and IDE.  Removed my modification from QR Code Gen library and now all is well.

Thank you!!!

Robert

Please Log in or Create an account to join the conversation.

Issue with QR Code Gen 3 years 3 days ago #16008

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4504
  • Thank you received: 1100
Thanks for your report Sir
have fun
PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

Last edit: by Sternas Stefanos.
  • Page:
  • 1