언어 설정

Menu
Sites
Language
SensorManager crash
I am getting an intermittent crash when trying to remove a sensor listener from Tizen::Uix::Sensor::SensorManager on app shutdown
I construct and add a listener for SENSOR_TYPE_ACCELERATION in Frame::OnInitializing, checking all the necessary return results to verify success, and checking SensorManager.IsAvailable(SENSOR_TYPE_ACCELERATION) , and using GetMinInterval to set the interval,  all seems fine;
 
I remove the listener in Frame::OnTerminating() like so-

result r = m_SensorManager.RemoveSensorListener(*this, SENSOR_TYPE_ACCELERATION);

Which all works fine, about 90% of the time; however occaisionally the app crashes on termination with the following error in the log
 
E/Assert  ( 7026): result Tizen::Uix::Sensor::<unnamed>::StopSensorType(sensor_handle_s*, sensor_type_e)(592) > StartSensorCoreEventSensing() > sensor_stop() failed. [handle:0x191550, sensorTypeE:0, result:-5]
 
Even in a release build, I still get the assertion message and the "closed unexpectedly" popup.
 
I don't understand what I'm doing wrong - can anyone help??!
 

 

Edited by: Brock Boland on 17 3월, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

7 댓글
Alan Savage
Some additional information on this - - if I don't call RemoveSensorListener at all, it still crashes sometimes with the same error ( but after Frame::OnTerminating() ) - if I attach the sensor listener in UiApp::OnForeground, and remove it in UiApp::OnBackground, it will sometimes crash with the same error while switching between foreground & background. This is a serious problem for me, as the app is failing store submission for this reason.
I think you should report a bug to http://bugs.tizen.org/ Tizen devs will answer you if it is a bug and if there is any solution for it
Alex Dem
Hi, I tried to reproduce issue using simple app which was created with 2.2.0 official sdk. I used device with 2.2.0 official firmware, but did not face with crash. In the sample Frame class was inherited from ISensorEventListener and OnDataReceived was reimplemented with empty body. I have added/removed listener for SENSOR_TYPE_ACCELERATION like it was described above in OnInitializing/OnTerminating. The minimum interval received from GetMinInterval is 20. Maybe there is another cause of crash or hardware/old firmware issue? Alexey.
Alan Savage
Thank you so much for your advice and efforts. I suspect that the problem may lie with my own build process, since I use a custom makefile to facilitate cross-platform compilation. If I compile the same codebase using the IDE, I cannot replicate the crash. It looks to be a call to SysAssertf in the platform code which causes the termination, so I wonder if the release IDE build simply ignores the assertion and carries on, while my custom makefile build does not...but that is just a wild guess...
alan cubero

Make sure that the sensor handle you are trying to close is still valid and has not already been closed or released. Garten Of Banban 2 Check for any null or invalid handles before calling RemoveSensorListener.

Bekean Loinse

You can also try to add a delay before calling the RemoveSensorListener() function in the OnTerminating() function to ensure that the sensor event thread has enough time to complete. Additionally, make sure that you are not releasing the sensor handle or the SensorManager instance prematurely.

Robert Losey

I solved it