QuickReport.ExportToFilter 抛出“堆栈溢出”在 TWebModule 中使用时出错
我有一个使用 TWebModule 组件的 Web 应用程序。它作为 Apache 上的模块运行。下面的代码在 ExportToFilter 上引发“堆栈溢出”错误。同样的代码在 Winforms 应用程序甚至服务中都可以正常工作。我看过其他关于此问题的讨论,表明它与线程有关。
var
mFileName: String;
AExportFilter:;
begin
mFileName := 'c:\temp\calendar.pdf';
AExportFilter:=TQRPDFDocumentFilter.Create(mFileName);
try
WebSchdHistCalendarForm := TWebSchdHistCalendarForm.create(nil);
WebSchdHistCalendarForm.quickrep1.ShowProgress := False;
WebSchdHistCalendarForm.quickrep1.ExportToFilter(AExportFilter );
finally
AExportFilter.Free;
WebSchdHistCalendarForm.Free;
end;
I have a web application using the TWebModule component. It runs as a module on Apache. The code below throws a "Stack Overflow" error on the ExportToFilter. The same exact code works fine from a Winforms Application and even a service for that matter. I have seen other discussions on this which indicate it has something to do with threading.
var
mFileName: String;
AExportFilter:;
begin
mFileName := 'c:\temp\calendar.pdf';
AExportFilter:=TQRPDFDocumentFilter.Create(mFileName);
try
WebSchdHistCalendarForm := TWebSchdHistCalendarForm.create(nil);
WebSchdHistCalendarForm.quickrep1.ShowProgress := False;
WebSchdHistCalendarForm.quickrep1.ExportToFilter(AExportFilter );
finally
AExportFilter.Free;
WebSchdHistCalendarForm.Free;
end;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我没记错的话,你会在无限递归方法调用时遇到堆栈溢出。但这里的情况可能并非如此。
If I'm not mistaken you get Stack overflow on infinite recursive method calls. This might not be the case here though.
虽然晚了 11 年,但这可能对其他人有用,因为我刚刚在某些 Windows 10 计算机上运行的应用程序之一遇到了这个问题。
(实际上,在我的例子中,Windows 事件日志将其报告为访问冲突,但通过在其中一台有问题的计算机上运行 WinDbg,我发现最初的原因是 cvtInt() 函数处的堆栈溢出。)< /em>
解决方法是在 QRPDFFilt.pas 中的几个函数中将 Buf 参数标记为 const:
应该是:
cvtDWord() 同样:(
感谢 Marco Filho 提供了这个解决方案,找到了在 devmedia.com.br)
Only 11 years late, but this might be useful to someone else, as I've just encountered this problem with one of my applications running on some Windows 10 machines.
(Actually in my case the Windows event log reported it as an access violation, but by running WinDbg on one of the problem machines I was able to see the initial cause was a stack overflow at the cvtInt() function.)
The fix is to mark the Buf parameter as const in a couple of functions in QRPDFFilt.pas:
should be:
and likewise for cvtDWord():
(Thanks to Marco Filho for this solution, found on devmedia.com.br)