#libWrapper register and unregister
1 messages ยท Page 1 of 1 (latest)
Can you confirm what you mean by "disable the module"? That usually implies a restart, but you wouldn't need unregister in that case.
Is it a setting that doesn't require restart, or something?
Do you have other modules enabled?
Does anything show up as a conflict in libWrapper's config window ("Conflicts" pane)?
Are there other active wrappers in the TOKEN_DRAG_START method (see the libWrapper config window "Active Wrappers" pane)? Does your module show up there after re-registering it?
yeah, i wanted to make it more clear, just didn't know how to say it properly :/, when i say "disable the module", i simply mean code wise, not the actual module, i have a client setting "enabled" and each user can opt to uncheck it, which will basically disable the module on their end (not from the world) and i want to unhook/unregister all the events that my module normally uses
makes sense. Can you check the other things I asked? Trying to figure out if it's something wrong with libWrapper, or a conflict with another module, or whatever
there's a bunch of unit tests around register/unregister so I wouldn't expect it to be a libWrapper bug, but who knows. The real world is sometimes not the same as unit tests ๐
otherwise, for your other points, i checked and my module is the only one in the libWrapper list and no conflict shown (even after reload)
but for some reason, i can't re-register a wrapper for CONFIG.Token.objectClass.prototype._onDragLeftStart
i see no errors
while the other wrapper works fine
does it show up in the "Active Wrappers" tab?
it does oO
is it the only one?
both
It shows up after the register/unregister/register, right? And it's the only wrapper in that method?
can you paste a screenshot of the active wrappers tab with both methods expanded? ACTOR_DERIVED_DATA and TOKEN_DRAG_START
hmm, and do they show up doubled when you re-register them?
and if i click on the "reload" button there and re-active my module, then i get an error
no double no
what libWrapper version do you have?
ok it was just a refresh issue with libWrapper window, they are actually gone when i disable the module
ah yeah you need to refresh, it doesn't poll
and you don't see anything in the console from libWrapper?
yeah...
but only one is working
do you see the wrapper called if you call the method manually on an actor?
gonna test on another system
e.g. try CONFIG.Actor.objectCall.prototype._onDragLeftStart.call(null)
(it will probably fail at some point because of this being null, but I'm interested if you see your message)
not working on another system either, so it is not that
oh yeah, it does log when i do it manually oO
how weird is that
ok, so that removes the most obvious failure case
are you sure whatever code you're relying on is actually calling it?
I can think of a few things that could be going wrong, but they all depend on someone else (the caller) doing something weird
i am not in control of anything here, it is just a drag event
yeah, but are we sure it is calling this drag event
I'm wondering if it's possible it's not this class or something
it is on the first register though
yeah but it could be superclassed or something fancy
the problem is that without seeing the caller I'm not sure how to debug the issue
PlaceableObject maybe instead of token ?
because if calling it directly works, the only ideas I have relate to either weird superclassing, non-libWrapper wrappers (wouldn't be a libWrapper bug), or a bug in the libWrapper handler mechanism
PlaceableObject.prototype._onDragLeftStart seem to be working
ok, let's try this
i need to check for type now
in the console, before unregistering, type this:
Object.getOwnPropertyDescriptor(CONFIG.Actor.objectCall.prototype, "_onDragLeftStart").get._lib_wrapper
then unregister, type it again
then re-register, type it again
give me the outputs
make sure to expand the getter_data field of the resulting object
hmm CONFIG.Actor.objectCall.prototype why that ?*
oops
CONFIG.Token.objectClass.prototype
typo ๐
Object.getOwnPropertyDescriptor(CONFIG.Token.objectClass.prototype, "_onDragLeftStart").get._lib_wrapper
so you want me to go back and register with CONFIG.Token.objectClass.prototype._onDragLeftStart ?
yeah, just give me the three views of that object, and expand getter_data
should give you something like this
also, I didn't ask, but do you have high performance mode enabled in the settings? Can you try toggling it?
getting an error actually
i don't understand why
it is clearly there
and my code works fine right now (i haven't disabled anything yet)
what's the output of just the first part?
Object.getOwnPropertyDescriptor(CONFIG.Token.objectClass.prototype, "_onDragLeftStart")
well the error says undefined
but if i switch to PlaceableObject.prototype._onDragLeftStart
it works
ok, that's your answer then
CONFIG.Token.objectClass is being replaced after you register your wrappers...
yeah, it is working with that wrapper
i can enable, disable and re-enable now
with PlaceableObject.prototype._onDragLeftStart
and the libWrapper bug is that it doesn't distinguish that they're different objects in the UI, since they have the same "name"
sure, I'll see what I can do to at least make it more obvious
I suspect if you had made the unregister fail, you'd have gotten an exception saying it wasn't found
ah wait, no, unregister uses a hashtable based on the name, rather than going to the object
I probably should change that
^^
debugging is not my forte
i think i would have tried the PlaceableObject.prototype._onDragLeftStart at some point but i learn few things thanks to you
I'll probably modify the libWrapper API to allow returning an ID, and unregistering by ID
then make the unregistering by string actually walk the string, rather than using the hashtable
and in the Active Wrappers UI I'll distinguish by ID, not just by name
thanks for the report / help too
@plucky narwhal v1.11.0.0 now supports the aforementioned unique target identifiers, and displays a numeric ID in the settings pane. It will also display the two methods separately and with different target IDs, making what was going on much more obvious.