Open Ennea opened 11 years ago
Additional info from talking on IRC:
The crash only happens when calling xchat.command("SAY ...") from anywhere in any Python plugin, after one hook handler has been registered for "Your Message" (and similar for ME and Your Action). Specifically, the following do NOT crash:
Yup, I can confirm that what Arnavion says is correct. Test code I created to make sure my code was not the culprit:
import xchat
import sqlite3
__module_name__ = "Test"
__module_version__ = "1.0"
__module_description__ = "Let's try things!"
def TestFunc(word, wordEOL, userData):
xchat.prnt("ACTION!")
return xchat.EAT_NONE
def TestCmd(word, wordEOL, userData):
xchat.command("ME test")
return xchat.EAT_NONE
xchat.hook_print("Your Action", TestFunc)
xchat.hook_command("testpy", TestCmd)
If, in fact, this code is also faulty.. well, that'd be embarrassing.
You made an infinite loop...
Er well looking at your example it isn't, but the description above sounds like it.
Trying your test script it works fine.
"Anywhere in any python plugin" == "not necessarily from within the hook itself"
@Arnavion his example calls it from within another hook and it works if that's what you mean.
When I said "from anywhere in any python plugin" in my first comment, it was because the first thing I'd ruled out was that he was creating an infinite recursion.
He himself said "using it in any Python plugin" and I reinforced it, but you ignored it anyway.
Silly TingPing!
Trying your test script it works fine.
Does it? It does not for me, I wonder why that is.. Also, not an infinite loop, obviously.
Edit: Sorry, apparently, that wasn't the issue. I should've tried running the test code with all other Python plugins disabled. The client will only crash with the test code when the plugin (or any other loaded one, for that matter) will also import the sqlite3 module. I added an import statement to the test code above, give it a spin.
Still works for me.
Doesn't for me. Any ideas what might be the issue, then? Because this is awkward..
Edit: Just for the record, client crashes when xchat.command() is called, so when using the created/hooked "testpy" command in this case.
Edit²: Another clarification: I'm using x86 Python and HexChat, running x64 Windows. A friend of mine tried my test code using x64 Python and HexChat and it worked. I'll give that a spin later.
Obvious question: did you try it with the most recent version from git? Does your friend with x64 use 2.9.4 aswell?
He was using the latest version from git. I'll give it a try later and keep you updated.
Sorry for the long wait on the update. I gave it a try using the x64 version of both Python and HexChat. No problems there. So the issue only occurs when:
To conclude: my sample code above does crash HexChat, but only the x86 version of it. Using it together with Python x64 and HexChat x64 works perfectly fine.
Confirmed crash W7 x64 with x86 Hexchat 2.9.4.
Does not crash Linux x64 with x64 Hexchat ToT.
I'm getting this problem too, except with Python 2.7.4 and HexChat 2.9.5, both x64 and on Windows 8.
Hooking the "Your Message" and/or "Your Action" text events with xchat.hook_print(), then using xchat.command() to use the "SAY" and/or "ME" command (depending on which event you hooked, if not both) will crash HexChat. Using the command normally through the client works just fine, using it in any Python plugin after it has been hooked before will lead to a crash.
OS: Windows 7 x64 Professional HexChat 2.9.4 Python 2.7.3