[Issue] ActiveX CreateObject locks dll

The Application Programming Interface and the OASIS Open Document Format

[Issue] ActiveX CreateObject locks dll

Postby anasrallah » Thu Apr 19, 2012 8:23 pm

Hi all,

I'm using the CreateObject method from a OOBasic macro to call an activeX dll (created using VB6). The functions in the class are called correctly with no problems, but once I'm done with the dll and close the document, the activex dll file stays locked by the soffice.bin process.
I have the openoffice quickstarter running, if I close the document without having the quickstarter running, the dll is getting released.
I'm using unlocker (http://www.emptyloop.com/unlocker/) to determine what process is locking my files.

here is a brief of what I'm experiencing

ActiveX DLL name: testlibrary.dll
Running: openoffice quickstarter

dim testlib
otestlib = CreateObject("testlibrary.testclass")
.......(function calls here)
otestlib = nothing


I close the odt file, run unlocker on testlibrary.dll, It says soffice.bin locking the file.

I would like to release the activeX dll once I'm done with it, otestlib = nothing is not doing the trick


Thanks
Last edited by Hagar Delest on Wed Apr 25, 2012 3:17 pm, edited 1 time in total.
Reason: tagged the thread as Issue (link to a bug report).
OpenOffice 3.3.0
Window 7
anasrallah
 
Posts: 10
Joined: Tue Apr 10, 2012 12:56 am

Re: ActiveX CreateObject locks dll

Postby rudolfo » Fri Apr 20, 2012 2:56 am

As far as I can see your problem is the Quickstarter. Why don't you simply run the (un-)installer for OpenOffice and de-activate the Quickstarter? It saves you 10 seconds when you start OOo for the first time. But what are 10 seconds compared to all the troubles it brings?

Really, I would like to see the Quickstarter de-activated by default in the next OOo realease.

If you are not planning to deploy your macro to other computers/users that's surely the way to go. Of course, you can also waste your precious time to figure out what the ActiveX module of OOo is doing and how its garbage collector works. But keep in mind that this part is only running on Win32 Systems, so you can bet that it is not so intensively tested as the other parts of OOo.
OpenOffice 3.1.1 (2.4.3 until October 2009) and LibreOffice 3.3.2 on Windows 2000, AOO 3.4.1 on Windows 7
There are several macro languages in OOo, but none of them is called Visual Basic or VB(A)! Please call it OOo Basic, Star Basic or simply Basic.
rudolfo
Volunteer
 
Posts: 1488
Joined: Wed Mar 19, 2008 11:34 am
Location: Germany

Re: ActiveX CreateObject locks dll

Postby anasrallah » Fri Apr 20, 2012 7:30 am

I need the Quickstarter because 10 seconds is a long time, for my application every second counts. I think the issue will show also if another odt is open.
maybe there is an alternative for CreateObject to create activex instances in basic. or possible another way to dispose an object once done with it.

Thanks
OpenOffice 3.3.0
Window 7
anasrallah
 
Posts: 10
Joined: Tue Apr 10, 2012 12:56 am

Re: ActiveX CreateObject locks dll

Postby anasrallah » Tue Apr 24, 2012 1:00 am

guys any idea??
there's got to be a way to remove references from memory.
OpenOffice 3.3.0
Window 7
anasrallah
 
Posts: 10
Joined: Tue Apr 10, 2012 12:56 am

Re: ActiveX CreateObject locks dll

Postby rudolfo » Tue Apr 24, 2012 9:01 pm

Well, no ideas from my side, I can only repeat what I've said before:
rudolfo wrote:Of course, you can also waste your precious time to figure out what the ActiveX module of OOo is doing and how its garbage collector works. But keep in mind that this part is only running on Win32 Systems, so you can bet that it is not so intensively tested as the other parts of OOo.

We are only users here, no developers. And for me I would summarize your post as "The garbage collector of OOo Basic is not working as it should do ...", so probably time to report a bug. See [Tutorial] Reporting bugs or suggestions.

Or depending on how intensively you use OpenOffice in your macro you can also use the OLE Automation/COM Interface of OpenOffice to drive it directly from Visual Basic or VBS, so the VB runtime will still do the cleanup of your ActiveX object, which is hopefully successfully tested.
OpenOffice 3.1.1 (2.4.3 until October 2009) and LibreOffice 3.3.2 on Windows 2000, AOO 3.4.1 on Windows 7
There are several macro languages in OOo, but none of them is called Visual Basic or VB(A)! Please call it OOo Basic, Star Basic or simply Basic.
rudolfo
Volunteer
 
Posts: 1488
Joined: Wed Mar 19, 2008 11:34 am
Location: Germany

Re: ActiveX CreateObject locks dll

Postby anasrallah » Tue Apr 24, 2012 10:03 pm

Just create a bug https://issues.apache.org/ooo/show_bug.cgi?id=119281
Thanks Rudolfo for the help
OpenOffice 3.3.0
Window 7
anasrallah
 
Posts: 10
Joined: Tue Apr 10, 2012 12:56 am

Re: ActiveX CreateObject locks dll

Postby ms777 » Fri Apr 27, 2012 9:15 pm

rudolfo wrote:... Or depending on how intensively you use OpenOffice in your macro you can also use the OLE Automation/COM Interface of OpenOffice to drive it directly from Visual Basic or VBS, so the VB runtime will still do the cleanup of your ActiveX object, which is hopefully successfully tested.


Another workaround would be to stay with OP Basic, and just wrap the CreateObject call into VB calls by MSScriptControl.ScriptControl. Some example below.

If you try that please let us know, if the dll locking persists ...


Good luck,

ms777

Code: Select all   Expand viewCollapse view
function GetOpenIEWindow2(sPath) as Object
  Dim oleService
  Dim VBScript
  Dim scr as string
  oleService = createUnoService("com.sun.star.bridge.OleObjectFactory")
  VBScript= oleService.createInstance("MSScriptControl.ScriptControl")
  VBScript.Language = "VBScript"

  s = ""   
  s = s + "Public oIE" + Chr(10)

  s = s + "SearchText = """ + sPath + """" + Chr(10)
  s = s + "set oShell = CreateObject(""Shell.Application"")" + Chr(10)
  s = s + "set oShellWindows = oShell.Windows" + Chr(10)
  s = s + "if (not oShellWindows is nothing) then" + Chr(10)     
  s = s + " for each o in oShellWindows" + Chr(10)
  s = s + "  if o.Name = ""Microsoft Internet Explorer"" then" + Chr(10)
  s = s + "   if Instr(1, o.LocationUrl, SearchText, 1) > 0 then" + Chr(10)
  s = s + "     set oIE = o" + Chr(10)
  s = s + "     end if" + Chr(10)
  s = s + "    end if" + Chr(10)
  s = s + "  next" + Chr(10)
  s = s + " end if" + Chr(10)

  VBScript.ExecuteStatement(s)
  GetOpenIEWindow2 = VBScript.CodeObject.oIE
End function
ms777
Volunteer
 
Posts: 138
Joined: Mon Oct 08, 2007 1:33 am


Return to UNO API and ODF

Who is online

Users browsing this forum: No registered users and 0 guests