VS2012中的一段时间后,Leap Listener控制器停止工作 [英] Leap Listener controller stops working after some time in VS2012

查看:70
本文介绍了VS2012中的一段时间后,Leap Listener控制器停止工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已在VS Express 2012 for Windows Desktop的Windows窗体应用程序中集成了Flash游戏(crazytaxi.swf)。我们正在使用Jumpmotion控制器借助手势来控制游戏。

We have integrated flash game (crazytaxi.swf) inside Windows form application in VS Express 2012 for Windows Desktop.We are controlling game with the help of gestures using leapmotion controller.

发生的事情是当我们在VS2012中运行项目时,游戏正常启动。我们使用手势(向左,向右等)玩游戏。但是过了一段时间,控制器通过退出其线程停止监听。我们可以在输出窗口中看到它。
线程’(0x1b50)已退出,代码为0(0x0)。

What happens is when we run project in VS2012,game starts normally.We play game using gesture (left,right etc.).But after some time controller stops listening by exiting its thread.We can see that in output window. "The thread '' (0x1b50) has exited with code 0 (0x0)." this we get in output window.

我们没有获得克服挑战的方法。

We are not getting how to overcome this challenge.

推荐答案

您没有提供足够的信息,但是根据我的收集,您的LEAP线程已运行完毕并关闭。如果在函数中声明并初始化侦听器和控制器变量,并且在执行函数时变量超出范围,则可能会发生这种情况。这导致垃圾收集器在看似随机(不可复制)的时刻处理控制器和侦听器。要解决此问题,请为控制器和侦听器创建一个单例-可以归结为简单地在某个类中定义静态控制器和侦听器变量。这样,侦听器和控制器对象将永远不会超出范围并被GC处理。

You didn't provide enough information but from what I gather, your LEAP thread ran to completion and closed. This can occur if you declare and initialize your listener and controller variables in a function and the variables go out of scope when the function is executed. This causes Garbage Collector to dispose both controller and listener at what might seemingly appear as random (non reproductable) moments. To fix this issue, create a singleton for the controller and listener - this can boil down to simply defining a static controller and listener variables in some class. This way the listener and controller objects will never go out of scope and get disposed by the GC.

这篇关于VS2012中的一段时间后,Leap Listener控制器停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆