Jump to content

Lajos Juhász

Members
  • Content Count

    838
  • Joined

  • Last visited

  • Days Won

    11

Posts posted by Lajos Juhász


  1. 4 minutes ago, bazzer747 said:

    What I really want to do is make backups of tables on a Live server and write them to tables on a different, backup server

    For this you should configure replication on the server IMHO that works best.

    • Like 1

  2. 35 minutes ago, balabuev said:

    Prove it.

    It's enough to insert anything between ShowModal and Free that will call an Application.ProcessMessages, for example to show another modal form and oops you get: 

    Project Project1.exe raised exception class EInvalidPointer with message 'Invalid pointer operation'.

    Something like:
     

    procedure TForm1.Button1Click(Sender: TObject);
    var x: TForm2;
        x2: TForm;
    begin
      x:=TForm2.Create(nil);
      x2:=nil;
      try
        x2:=Tform2.Create(nil);
        if x.ShowModal=mrOk then
          x2.showmodal;
      finally
        x.free;
        x2.free;
      end;
    end;


     


  3. 12 minutes ago, balabuev said:

    Good observation, but wrong.

    No it's not wrong. Sometimes it can result an Access Violation, it will cause no problem if in the meanwhile the handle is not used otherwise you cannot predict the result.

     


  4. 3 minutes ago, Remy Lebeau said:

    I said to use THandleStream, not TFileStream.  TFileStream does not have a constructor that accepts an external THandle as input.

     

     

    TFileStream is derived from THandleStream and unlike the THandleStream it will close the file in the destructor as I showed in my earlier post, so it's just a try ... finally less to write.

     


  5. 4 minutes ago, KodeZwerg said:

    By reading CreateFileW() doc  I wonder what happen with created Handle.

    Wouldnt it be better to split it up and call CloseHandle() afterwards?

    The answer is here, the TFileStream will take over the ownership and close it in the destructor (FileClose will call CloseHandle):
     

    destructor TFileStream.Destroy;
    begin
      if FHandle <> INVALID_HANDLE_VALUE then
        FileClose(FHandle);
      inherited Destroy;
    end;

     

    • Thanks 1

  6. Thanks Remy I missed the part that you can give a Handle to the TFileStream constructor. You can replace the file using this code. Of course you've to make sure first the file exists:
     

    procedure TForm1.FormCreate(Sender: TObject);
    var lStrList: TStringList;
        lfStream: TFileStream;
        lFileName: PChar;
    begin
      lFileName:='D:\temp\0104.txt';
      lStrList:=TStringList.Create;
      lfStream:=TFileStream.Create(Createfile(lFileName, GENERIC_WRITE, FILE_SHARE_WRITE, nil, CREATE_ALWAYS, GetFileAttributes(lFileName), 0));
      try
        lStrList.SaveToStream(lfStream);
      finally
        lfStream.Free;
      end;
    end;

     

    • Like 2

  7. You're right.  A hidden file can be replaced only with a hidden file. Unfortunately you cannot create a hidden file as in FileCreate the attribute is hard coded to be FILE_ATTRIBUTE_NORMAL.


  8. 26 minutes ago, A.M. Hoornweg said:

    I noticed that all of my non-visual COM DLL's nevertheless pull in huge chunks of the visual VCL, including units VCL.Forms, VCL.Themes, VCL.Imagelist etc.  I am absolutely sure that I don't use these routines anywhere and still they make up over 60% of the executable's code! The underlying cause is that all of the xxxx_TLB.PAS files, which the IDE auto-generates,  use a unit called OleServer which has an initialization section. No code in the unit itself is called, but the initialization section manages to pull in most of the VCL for whatever reason.

    I think is a poorly engineered code for the IDE. As I scanned the code most probably only the initialization section requires the VCL.Controls and for this one:

     

    GroupDescendentsWith(TOleServer, Vcl.Controls.TControl);

     

    I've no idea where is this used as find in files returns that RegGroups is only used in System.Classes so my guess is that it is for the IDE. Why they polluted the code only to be used in the IDE? Most probably it could be moved in some package used only by the IDE and not pollute user executables. I wonder what @Marco Cantu, @David Millington or @Dmitry Arefiev can publicly say about this case.


  9. 23 hours ago, balabuev said:

    Confirmed. I can reproduce it. However in my case no stack overflow occured. IDE simply hang out (forewer) with this small popup window:

    In order to get the stack overflow you've to activate the debug the IDE. Create a new empty package. In Run -> Parameters set Host application to C:\Program Files (x86)\Embarcadero\Studio\21.0\bin\bds.exe. Run and click continue for the  Debugger exception notifications. When the second instance of the IDE appear open a project and then you can see the stack overflow.


  10. 4 hours ago, FredS said:

    There are no international characters that should be (ANSI):

    For me also the IDE asked for international characters (looks like the forum likes to insert those ones).

     

    Congratulation you managed to make Delphi unresponsive without debugging. With debug I also get: Project bds.exe raised exception class $C00000FD with message 'stack overflow at 0x51ef04f2.

    :51ef04f2 ; C:\Windows\SysWOW64\msxml6.dll
    :51f16f2d ; C:\Windows\SysWOW64\msxml6.dll
    :51f56860 ; C:\Windows\SysWOW64\msxml6.dll
    :51f296da ; C:\Windows\SysWOW64\msxml6.dll
    :51f566ea ; C:\Windows\SysWOW64\msxml6.dll
    :51f18b90 ; C:\Windows\SysWOW64\msxml6.dll
    :51f18163 ; C:\Windows\SysWOW64\msxml6.dll
    xmlrtl.Xml.Win.msxmldom.TMSDOMNodeList.get_length
    xmlrtl.Xml.XMLDoc.TXMLNode.GetIsTextElement
    :0c1b42ec ; c:\program files (x86)\embarcadero\studio\21.0\Bin\IDELSP270.bpl
    :0c1b4390 ; c:\program files (x86)\embarcadero\studio\21.0\Bin\IDELSP270.bpl
    :0c1b4390 ; c:\program files (x86)\embarcadero\studio\21.0\Bin\IDELSP270.bpl
    :0c1b4390 ; c:\program files (x86)\embarcadero\studio\21.0\Bin\IDELSP270.bpl
    :0c1b4390 ; c:\program files (x86)\embarcadero\studio\21.0\Bin\IDELSP270.bpl

    .....cut, here the IDELSP270.bpl repeats 9992 times.....

    :0c1b4390 ; c:\program files (x86)\embarcadero\studio\21.0\Bin\IDELSP270.bpl
    :0c1b4390 ; c:\program files (x86)\embarcadero\studio\21.0\Bin\IDELSP270.bpl
    fmx.FMX.Platform.Win.TPlatformWin.ThreadSync(???)
    rtl.System.Classes.StdWndProc(1705986,0,0,0)
    vcl.Vcl.Forms.TApplication.ProcessMessage(???)

    image.png

    • Thanks 1

  11. 4 hours ago, balabuev said:

    I removed as much as possible from your demo. It's now independent from SVG image list, and refers only to standard components. I removed almost all code also.

    Source.zip

     

    You forgot to remove the build event. I've tested with Delphi 10.4.2 and the bug is still there:
     

    ---------------------------
    Unexpected Memory Leak
    ---------------------------
    An unexpected memory leak has occurred. The unexpected small block leaks are:

    13 - 20 bytes: UnicodeString x 2
    21 - 28 bytes: UnicodeString x 4
    45 - 52 bytes: TTreeNode x 6

    ---------------------------
    OK   
    ---------------------------
     

    PS. It looks like that seBorder in the TListView's Styleelement is the problem. Remove it and the leak dissapear!


  12. while  FDTableTask.EOF do begin
      FDTableTask.First;
    end;

    This is not correct first will move the cursor to the beginning of the query. You should call FDTableTask.Next, also if the loop contains only the call for the next record you can replace the loop with FDTableTask.Last to jumb to the last record.


  13. IMHO it's not the sam RSP-24383 is about var parameters. The parameter intToStr is not a var parameter. For example:

     

     

    procedure TForm1.FormCreate(Sender: TObject);
    var
      i: record
        a,b,c: integer;
      end;
      a: integer;
    begin
      i.a:=i.b;
      IntToStr(a);
      IntToStr(i.c);
    end;

    I have only one warning:

    [dcc32 Warning] Unit1.pas(35): W1036 Variable 'a' might not have been initialized

     

     


  14. 32 minutes ago, Serge_G said:

    Well this is a rule I knew  and accept the warning,   but anybody that can go to Quality Portal can see Dimitry response no ?

    Only if the QP entry is entered for released version of Delphi. The entries for beta versions are usually locked and can be seen only by the beta testers. 


  15. 1 hour ago, Lars Fosdal said:

    The IDE editor supports Unicode, but most fonts do not have every Unicode character for every language defined, hence which font is being used, really matters.

    Are you sure about that? Pleas try to paste this to the IDE (example from: https://en.wikipedia.org/wiki/Precomposed_character)

    Åström (U+0041 U+030A U+0073 U+0074 U+0072 U+006F U+0308 U+006D)

     

    The result is:

     

    image.thumb.png.9ca07daf58006eef7e705e4a2c6e6344.png

     

    It doesn't render it well. If you assign this string to a label.caption then Windows will display it correctly:

    image.png.e139d8875d3d4a780160408bf7061bca.png

     

    Even if I paste the code from Delphi here the forum can display it correctly.

    procedure TForm4.FormCreate(Sender: TObject);
    begin
      label1.Caption:='Åström (U+0041 U+030A U+0073 U+0074 U+0072 U+006F U+0308 U+006D)';
    end;

     

×