Languages

Menu
Sites
Language
Application crasher after exit

Hi,

After I exit my application I get error (details described below). In application I'm running camera using AppControl class. Error occurs only when I open camera and get back to my application. If I'm not opening camera then application closes normally. 

I'm not using Mutex in my code.

ERROR / Assert ( 13183 : 13183 ) : result Tizen::Base::Runtime::Mutex::Acquire()(106) > Not yet constructed! Construct() should be called before use.

Call stack:

(sorry for an image but plain text was treat as spam)

Responses

28 Replies

I think you have to clean the app. You have object you forget to delete in the OnTerminating method

 

Kamil N

noure,

I checked using Dynamic Analyzer I delete every object in OnTerminating. This error occurs only if i run camera:

see log:

02-08 10:58:35.160 : INFO / AppFo ( 14888 : 14888 ) : int OspMain(int, char **)(31) > Application finished.
02-08 10:58:35.170 : ERROR / Assert ( 14888 : 14888 ) : result Tizen::Base::Runtime::Mutex::Acquire()(106) > Not yet constructed! Construct() should be called before use.

It looks like Acquire() is called internally.

Kamil

 

Kamil N

I think something is wrong with my app. I created empty application and run camera there. Everything finished without error.

Yes, you have to clean something wrong. Every crash after app exits is about "no clean" code or if you are trying to clean (delete) pointer that was not initialized coz these pointers are not NULL be default.

You can avoid it but constructing pointers to null and then if you delete that pointer on exit, there will be no crash

 

Kamil N

nour, but this error occurs only when i run camera via AppControl. Code to run camera I took from the documentation. . Still don't know why it crashes

Alex Ashirov

Strange. I called Camera via AppControl from my test app without any problems. It seems that something is wrong in your app.

Kamil N

I also tested it with sample app and everything was ok. Problem is that in my application I'm using threads and Player and app closes normally if I'm not using AppControl:

String mime = L"image/jpg";
   HashMap extraData;
   extraData.Construct();
   String typeKey = L"http://tizen.org/appcontrol/data/camera/allow_switch";
   String typeVal = L"true";
   extraData.Add(&typeKey, &typeVal);

   AppControl* pAc = AppManager::FindAppControlN(L"tizen.camera", 
                                                 L"http://tizen.org/appcontrol/operation/create_content");
   if (pAc)
   {
      pAc->Start(null, &mime, &extraData, this);
      delete pAc;
   }

Later I will test with different appcontrols like calendar or internet browser.

 

What about (OnAppControlCompleteResponseReceived) code? what are you doing there?

 

 

Alex Ashirov

Right. Looks like something related to thread synchronization. Have you tried with other AppControls?

Kamil N

Check results (same way as described in documentation) but error occurs even if I press back  key when camera is running - then nothing is execute in OnAppControlCompleteResponseReceived aslo for test purpose I removed listener in Start() method and replaced it with null then OnAppControlCompleteResponseReceived was not called but error was.. Very strange.

Comment your code (one by one) in the OnAppTerminating and see what pointer is causing the problem. Comment Player pointer object and try..etc..

I think you code is trying to delete object pointer which is not allocated

 

Kamil N

@ Alex Ashirov

Have you tried with other AppControls?

I tried with tizen.contacts and result is the same. Crash.

02-10 16:28:51.145 : ERROR / Assert ( 16840 : 16840 ) : result Tizen::Base::Runtime::Mutex::Acquire()(106) > Not yet constructed! Construct() should be called before use.

 

@nour

I think you code is trying to delete object pointer which is not allocated

But in OnTerminating my code do the same things if I run AppControl and not.

 

Kamil N

I commented all code in OnTerminating and it didn't help. Crash stack trace:

 

Callstack Information (PID:17703)
Call Stack Count: 5
 0: gsignal + 0x3c (0x403dd760) [/lib/libc.so.6] + 0x2a760
 1: abort + 0x1ac (0x403e155c) [/lib/libc.so.6] + 0x2e55c
 2: __gnu_cxx::__verbose_terminate_handler() + 0xda (0x423751e7) [/usr/lib/libstdc++.so.6] + 0x881e7
 3: __cxxabiv1::__terminate(void (*)()) + 0x4 (0x42373d99) [/usr/lib/libstdc++.so.6] + 0x86d99
 4: std::terminate() + 0x10 (0x42373db5) [/usr/lib/libstdc++.so.6] + 0x86db5
End of Call Stack

Well the system is trying to clean a mutex (thread) that was not constructed and therefore you got a crash. I don't know where is the problem. I used AppControl several times and had no crash

Kamil N

I found root cause of this error. I'm using static class Player and if I call Player Construct() and later run AppControll then application crasher after exit. Still don't know how to fix that. 

Kamil N

I created very simple app based on template and implemented similar scenario to my app. After exit application crash. Maybe someone from Tizen Development Team should check this scenario?

 

Link to exported sample app: https://dl.dropboxusercontent.com/u/90568703/Sample.zip

Alex Ashirov

Hi,

I have tried your sample. I didn't observe any crashes. Do you exit from the app using Back key? I launched the app. Pressed Ok button -> Camera AppControl appeared. Then I pressed the Back button twice in order to exit from Camera and the app itself. I didn't observe crash.

Kamil N

Hi,

I checked Sample and my app today on the different PC and emulator and botd closed normally. I observed error on RD-PQ device. I will reinstall system on the device and make further investigation.

Alex Ashirov

It's strange... Because I didn't observe crash on device but I have just observed it in on emulator. After that I tried to replace the static __player variable with non-static one and the crash was gone. You can try to do the same - to make the __player non-static.

 

Kamil N

Alex, I observe totally different behavior. Emulator on the other PC works / Emulator on my PC and the device don't.

I need static Player because I have static methods Play(), Stop, Pause etc in separate class and for example I can turn on/off music in many placess without passing Player instance as a reference.

 

Regards

Kamil

Alex Ashirov

Kamil,

In such case you can store static pointer instead of static object and initialize the pointer in the SampleAppControlMainForm::OnInitializing() just before Construct(). I have tried this and this works without crash.

Kamil N

Alex I will implement your solution.Thanks! Also I reported this behaviour to bugs.tizen.org and I will let you know when I get some feedback.

Regards

Kamil

If you think it is bug, report it to bugs.tizen.org

I have app using Player class and I do use SendUserEvent as solution instead of static Player instance to send request between the separate class and the main form class where non-static instance of Player, otherwise, like what Alex said!

I do think you should learn how to use SendUserEvent, it is very good and keeps your code clean

 

 

 

Slawek Kowalski

Log says: you close sth but it wasn't constructed prior. Please check objects you create.

Kamil N

@Alex

I replace static Player to static Player* and it works now. So problem may be treated as SOLVED, however i reported this scenario to bugs.tizen.org

 

regards

Kamil

Alex Ashirov

Hi Kamil,

Have you received any response from the bugs.tizen.org?

Kamil N

Hi Alex,

2h ago:

Please do not declare the Player instance as a static variable. It's not a POD type.

 

Kamil

Alex Ashirov

Hi Kamil,

Ok. They answered exactly as we supposed;)

Alex