Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Bug reports ➜ Plugin Reinstall...

Plugin Reinstall...

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Shadowfyr   USA  (1,791 posts)  Bio
Date Sun 09 Nov 2003 03:45 AM (UTC)
Message
It seems that when Mushclient reinstalls a plugin, any 'open' references to ActiveX objects remain intact. They should instead be closed some way. If you do this:

dim hndl
set hndl = createobject("some object")
set hndl = createobject("some object")

Then the first version would close. This is 'basically' what reinstalling the plugin should be doing, even if the state file kept a copy of the original contents. The reference should be invalid, Mushclient and/or the script engine should have released the connection and the object should have terminated itself. Instead, the first one remains and a new one is created, which means that Mushclient is probably not correctly releasing the script engine instance that the plugins code is in.

This is incorrect behaviour, and worse yet, reinstall doesn't execute the plugins OnPluginClose sub either, so the developer can't use 'set hndl = nothing' to terminate the object either. This is imho not a good thing, especially if the object is a huge ActiveX program, such as Word or Excel. Reinstalling a plugin that automatically openned such an ActiveX program every time would quickly eat all of your machines system resources very quickly. Not to mention other unpredictable problems that may exist as a result.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 11 Nov 2003 09:10 PM (UTC)
Message
Quote:

This is incorrect behaviour, and worse yet, reinstall doesn't execute the plugins OnPluginClose sub either, so the developer can't use 'set hndl = nothing' to terminate the object either.


Actually this is an incorrect statement that MUSHclient has incorrect behaviour. Perhaps two "incorrects" will cancel out? I wrote this small trial plugin:



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient>
<!-- Saved on Wednesday, November 12, 2003, 8:59 AM -->
<!-- MuClient version 3.42 -->

<!-- Plugin "plugin_reinstall_test" generated by Plugin Wizard -->

<muclient>
<plugin
   name="plugin_reinstall_test"
   author="Nick Gammon"
   id="76ace0acc069b1710053d990"
   language="VBscript"
   purpose="testing onpluginclose"
   date_written="2003-11-12 08:58:30"
   requires="3.42"
   version="1.0"
   >

</plugin>


<!--  Script  -->

<script>
<![CDATA[
sub OnPluginClose
world.Note "plugin closed."
end sub
]]>
</script>

</muclient>



As you can see it simply notes whenever the plugin is closed. If you install it, and reinstall it, you will see "plugin closed." for every reinstall. Thus, you can use OnPluginClose to close any open COM objects. MUSHclient can't do it directly as it has no knowledge of what you are doing in your scripts.

Quote:

Mushclient and/or the script engine should have released the connection and the object should have terminated itself.


MUSHclient certainly attempts to do this. The plugin reinstall first deletes the plugin, which calls the plugin destructor (we are talking C++ talk here). The destructor calls DisableScripting (see below). DisableScripting does its best to disconnect, close and release the script. If that doesn't close the COM objects I'm not sure what else to do. :)



void CScriptEngine::DisableScripting (void)
  {

  // release engine

  if (m_IActiveScript)
    {
    m_IActiveScript->SetScriptState(SCRIPTSTATE_DISCONNECTED);
    m_IActiveScript->Close ();
    m_IActiveScript->Release ();
    m_IActiveScript = NULL;
    }

  // release parser

  if (m_IActiveScriptParse)
    {
    m_IActiveScriptParse->Release ();
    m_IActiveScriptParse = NULL;
    }

  // release site

  if (m_site)
    {
    m_site->Release ();
    m_site = NULL;
    }

  } // end of CScriptEngine::DisableScripting 





- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Shadowfyr   USA  (1,791 posts)  Bio
Date Reply #2 on Wed 12 Nov 2003 01:48 AM (UTC)
Message
Hmm.. Very odd.. The plugin I ran into this with has apparently not been posted by magnum, but the object I used is at> http://www.magma.ca/~magnumsw/muds/mc_firework.zip

It has occured to me that I should probably add a OnFireworkClose sub to the control, so that at least by clicking the close button on it, it would terminate with a simple 'End', but it still fails to explain why the plugin didn't seem to terminate the original correctly. :(
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #3 on Wed 12 Nov 2003 09:54 AM (UTC)
Message
As I said in an Email to you, ShadowFyr, I put the plugin xml file into the same zip file as your program to display graphical fireworks. Seemed sensible to me, since they work hand-in-hand.

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Shadowfyr   USA  (1,791 posts)  Bio
Date Reply #4 on Wed 12 Nov 2003 07:06 PM (UTC)
Message
Yes. I posted this before I read the email. However, placing the plugin into the zip is slightly misleading, since while the plugin is specific to Ages of Despair, the gadget isn't even intended to be used solely with Mushclient, let alone with our mud. That is why I had them seperate.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


17,396 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.