YITechnology / YIOpenAPI

YI Open API provides mobile SDKs and reference designs for software developers and hardware makers to build cool apps and products with YI 4K Action Cameras
Other
345 stars 76 forks source link

Unable to re-initialize platform after it has been uninitialized #73

Open mmarich opened 6 years ago

mmarich commented 6 years ago

After calling Platform.initialize() then performing actions with an ActionCamera instance and finally calling Platform.uninitialize(), any subsequent to Platform.initialize() results in an IllegalThreadStateException being thrown.

When looking at decompiled source, it appears that Platform gets the singleton instance of AsyncSocketWorkThread from AsyncSocketWorkThread.getInstance().

A work around is to never call Platform.uninitialize(), since Platform.initialize() appeard to check if it has been initialized. That said, there is now a zombie thread hanging around.

I believe that AsyncSocketWorkThread.getInstance() should be modified so that dead threads are discarded.