Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Net.CrossSocket.Base.pas _Log 在debug模式下,報内存分配和非法訪問的錯誤。 #131

Open
wqmeng opened this issue May 3, 2024 · 1 comment

Comments

@wqmeng
Copy link

wqmeng commented May 3, 2024

procedure _Log(const S: string); overload;
begin
  if Assigned(_CrossLogger) then
    _CrossLogger(S)
  else
  begin
    {if IsConsole then  
      Writeln(S);            // 報錯位置。
    AppendLog(S);}      // 報錯位置。
  end;
end;

今天用單元測試,測試一個socket通信,使用的是控制臺應用。_Log 這裏開始報錯。

另外請教一個問題,

FSocket關閉的時候, 要先停掉什麽?我看示例Demo程序裏面,是
Delphi-Cross-Socket\Net\Demos\Old\TestCrossSocket

  FSocket.StopLoop;
  FSocket := nil;

之前我一直是

  FSocket.CloseAll;
  FSocket.StopLoop;
  FSocket := nil;

但是今天測試的時候上面的代碼在 StopLoop 這裏報錯。
然後又改成了這樣,好像要好一些。

  FSocket.DisconnectAll;
  FSocket.CloseAll;
  Sleep(20);
  FSocket.StopLoop;
  FSocket := nil;

謝謝。

@winddriver
Copy link
Owner

最好提供能复现问题的完整工程,才好确定到底是哪里的问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants