简体   繁体   English

如何修复:尝试使用OfficeDatabaseDocument UNO服务进行load()时的“堆栈内存不足”

[英]How to fix :“Not Enough Stack Memory” when trying to load() with OfficeDatabaseDocument UNO service

I try to familiarize myself with the usage of Macro and UNO API on LibreOffice Base, i tried to open my .odb file with the UNO OfficeDatabaseDocument (DOC here : https://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1sdb_1_1OfficeDatabaseDocument.html#a3d0b1f053d53f5b196e4c19e55a519ae ) to play with UNO and learn to use them. 我试图使自己熟悉LibreOffice Base上的Macro和UNO API,我尝试使用UNO OfficeDatabaseDocument(DOC here: https ://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1star_1_1sdb_1_1OfficeDatabaseDocument打开我的.odb文件.html#a3d0b1f053d53f5b196e4c19e55a519ae )与UNO一起玩并学习使用它们。

Function MyClubOfficeDatabaseDocument()
    Dim MyClubURL(0) As New com.sun.star.beans.PropertyValue
    MyClubURL(0).Name = "Chemin d'accès vers la base de donnée MyClub"
    MyClubURL(0).Value = "/Users/faisalsalhi/Desktop/MyClub/MyClub.odb"

    MyClubOfficeDatabaseDocument = CreateUnoService("com.sun.star.sdb.OfficeDatabaseDocument")
    MyClubOfficeDatabaseDocument.load(MyClubURL)
End Function

I got a run time error saying that i have not enough stack memory to do this. 我收到一个运行时错误消息,说我没有足够的堆栈内存来执行此操作。

You're running out of stack memory because you've set up an infinite recursion. 您已经耗尽了堆栈内存,因为您已经设置了无限递归。 That is, your function, MyClubOfficeDatabaseDocument , is called within itself, which then calls itself again, and again, and again, ad infinitum. 也就是说,您的函数MyClubOfficeDatabaseDocument在其内部被调用,然后又一次又一次地无限制地调用自身

The only way to fix this is to eliminate the infinite recursion. 解决此问题的唯一方法是消除无限递归。

You should be able to fix it by simply changing either your function name or variable name. 您只需更改函数名或变量名就可以修复它。 For example, you could change the function name to LoadMyClubOfficeDatabaseDocument . 例如,您可以将函数名称更改为LoadMyClubOfficeDatabaseDocument

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM