brinley / jSignature

jQuery plugin for adding web signature functionality
http://www.unbolt.net/jSignature
696 stars 529 forks source link

Error in PubSubClass after resizing #51

Closed willtcarey closed 10 years ago

willtcarey commented 10 years ago

Unable to get property '0' of undefined or null reference Stack: jSignature.js Line Number:72

After we do a window resize we occasionally get this error. This is hard to reproduce for us, but happening fairly regularly at one of our customers sites.

If you need any more information, let me know

brinley commented 10 years ago

Are you able to trigger this error on resize even if no signature is drawn?

willtcarey commented 10 years ago

Yes we are. I managed to get it narrowed down. We have jSignature being used inside of a popup, and the first time that popup opens the user can do all the resizing they want, but they can also close that popup and reopen it a second time, and that second time they open it, it triggers the error if they do any resizing. We are calling reset on jSignature before they close the popup, but is there some sort of state data that is not being cleared?

brinley commented 10 years ago

I suspect that the subscribed event for the first instance was still getting triggered and I suppose you are initializing a new jSignature instance? To confirm, can you run $("#signature").jSignature("globalEvents") before you close the modal and run $("#signature").jSignature("globalEvents") again after you reopen the modal as see if there is any difference.

mgedmin commented 10 years ago

This is the issue I tried to fix with https://github.com/willowsystems/jSignature/pull/44.

I'm confused about what the right upstream repo for this library is. The 1st google hit for "jsignature" points to http://willowsystems.github.io/jSignature/#/about/ which points to https://github.com/willowsystems/jSignature which says it's a fork of this one, but differs in exactly zero commits. Issues and pull requests made against willowsystems get no response.

brinley commented 10 years ago

Willowsystem's version is a fork of my jSignature. I am not affiliated with them so I do not monitor their repo. I assume they are the first google hit because they have better SEO. If your fix works, send me a PR and I'll have a look and merge to my repo if it looks good.

mgedmin commented 10 years ago

I rebased my fix on top of your master, and I see that you already fixed the TypeError in PubSubClass.unsubscribe(), in a slightly different way.

I haven't had the time to fix the TypeError in PubSubClass.publish() yet. I'll submit a PR when I do.

sondlerd commented 7 years ago

did this error get fixed? I'm getting this error now.