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 ➜ Crash when calling SaveState() during OnPluginSaveState

Crash when calling SaveState() during OnPluginSaveState

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


Posted by Manacle   (28 posts)  Bio
Date Thu 30 Dec 2010 02:52 AM (UTC)
Message
Due to a type coupled with an unfortunately named routine in my window manager plugin, I discovered that when I call the global function SaveState (with or without arguments, which in my case would have included a meaningless set of nested tables) during OnPluginSaveState (but not, oddly, during OnPluginEnable), I cause MUSHClient itself to crash silently.
Top

Posted by Manacle   (28 posts)  Bio
Date Reply #1 on Thu 30 Dec 2010 02:55 AM (UTC)

Amended on Thu 30 Dec 2010 02:56 AM (UTC) by Manacle

Message
This was, by the way, using MUSHClient v4.70, and the exact close that caused the error was:

function OnPluginSaveState()
SaveState(campaignwindow)
SaveState(questwindow)
SaveState(gquestwindow)
end

(editted to show the old code, not the new code that works)
Top

Posted by Nick Gammon   Australia  (23,169 posts)  Bio   Forum Administrator
Date Reply #2 on Thu 30 Dec 2010 05:22 AM (UTC)
Message
SaveState does not take any arguments.

Template:function=SaveState SaveState

The documentation for the SaveState script function is available online. It is also in the MUSHclient help file.



It simply causes the plugin state to be saved. Calling that in OnPluginSaveState is likely to cause a stack overflow, because you call SaveState which then calls OnPluginSaveState which then calls SaveState and so on until you run out of stack space.


- Nick Gammon

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

Posted by Manacle   (28 posts)  Bio
Date Reply #3 on Thu 30 Dec 2010 05:32 AM (UTC)
Message
...when I call the global function SaveState (with or without arguments...

I'm sorry, I should have been more clear that I actually wasn't complaining about SaveState not working the way I thought it would (I actually meant to call WindowManager.SaveState, but I've since refactored that library so I can't make this mistake again).

I see though that it's not a bug or a use scenario that's worth detecting and handling gracefully. Thank you for your response and the explanation of what was happening.
Top

Posted by Nick Gammon   Australia  (23,169 posts)  Bio   Forum Administrator
Date Reply #4 on Thu 30 Dec 2010 05:34 AM (UTC)
Message
I have amended the client do disallow loops of this sort by detecting if it is saving its state and not allowing you to save it while it is being saved already.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


18,786 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.