Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash When Disabling TouchPose #16

Open
phoney opened this issue Jun 26, 2015 · 3 comments
Open

Crash When Disabling TouchPose #16

phoney opened this issue Jun 26, 2015 · 3 comments
Assignees
Labels

Comments

@phoney
Copy link

phoney commented Jun 26, 2015

I'm working on a demo app where I want the user to be able to enable/disable Touchpose. To enable/disable Touchpose I call

((QTouchposeApplication *)[UIApplication sharedApplication]).alwaysShowTouches = isShowingTaps;
((QTouchposeApplication *)[UIApplication sharedApplication]).showTouches = isShowingTaps;

where isShowingTaps is a BOOL.

When disabling Touchpose I get a crash in QTouchposeFingerView:removeFromSuperview inside the call to super. This is called from setShowTouches:

The only way I could fix this was to move the animation from QTouchposeFingerView:removeFromSuperview to QApplication:UpdateTouches, and remove the QTouchposeFingerView:removeFromSuperview override.

Like this

           if (fingerView != NULL)
            {
                // Remove the touch from the 
                CFDictionaryRemoveValue(_touchDictionary, (__bridge const void *)(touch));
// The fingerView override of removeFromSuperview crashes when turning off showTouches
// after it was already on. Moving the animation here fixes the problem.
               [UIView animateWithDuration:_touchEndAnimationDuration animations:^{
                    fingerView.alpha = 0.0f;
                    fingerView.layer.transform = _touchEndTransform;
                } completion:^(BOOL completed){
                    [fingerView removeFromSuperview];
                }];
            }
@satchnut
Copy link

bump. I'm getting the same issue.

@toddreed toddreed added the bug label Sep 25, 2016
@toddreed toddreed self-assigned this Sep 25, 2016
toddreed added a commit that referenced this issue Sep 26, 2016
This refactoring introduces a backwards incompatible API change: the `alwaysShowTouches` and `showTouchesWhenKeyboardShown` properties are now gone, and the semantics of `showTouches` has changed.

`showTouches` is now more predictable and reflects whether touches are being rendered or not. `alwaysShowTouches` is sort of replaced by `automaticallyManageTouchesWhenScreenMirrored`, which, if YES, will automatically set `showTouches`.

Added a notification (QTouchposeTouchesVisibleDidChange) for monitoring changes to `showTouches`.

This resolves #16 and resolves #11.
@gatamar
Copy link

gatamar commented May 25, 2021

@toddreed Thank you for the library!
I've also experienced this crash: https://stackoverflow.com/questions/67689067/can-we-check-if-an-objc-object-was-deallocated-before-bridging-it-from-void-t
Have you considered changing CFDictionary to NSMapTable (in the develop branch)?

@toddreed
Copy link
Owner

@gatamar: I created a new issue (#22) for this, as I think it’s an unrelated crash. I pushed a commit (525ce7b) to develop that should fix this (that is #22). Please try it out and let me know if that resolves your crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants