XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 0.11.0
    • 0.12.0
    • Delphi - Library
    • None

    Description

      In Delphi all methods that refer to VCL should do it only from main thread. But class TGUIConsole despite the name does not contain any synchronization methods.

      My suggestion is to rename this class to TStringsConsole, make method InternalWrite virtual and make new class TGUIConsole inherits from TStringsConsole

       

      TGUIConsole = class( TStringsConsole )
      protected
         procedure InternalWrite(const S: string; bWriteLine: Boolean); override;
      end;
      { TGUIConsole }
      procedure TGUIConsole.InternalWrite(const S: string; bWriteLine: Boolean);
       begin
         if TThread.CurrentThread.ThreadID <> MainThreadID then begin
           TThread.Synchronize(nil, procedure
             begin
               inherited InternalWrite(S, bWriteLine);
             end
           );
         end else
           inherited InternalWrite(S, bWriteLine);
       end;
      

       

      Attachments

        Activity

          People

            jensg Jens Geyer
            AntonTramp Anton Shchyrov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: