A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
overtired
Gnoblar
Posts: 14 Joined: Tue Oct 23, 2018 1:32 pm
x 1
Post
by overtired » Mon Jan 21, 2019 12:44 pm
Hello! I met a problem with using ogre in a separate activity inside android application. When I collapse android application, then restore it, I got the error
Code: Select all
/ogre/OgreMain/include/OgreSingleton.h:76: Ogre::Singleton<Ogre::Root>::Singleton() [T = Ogre::Root]: assertion "(!msSingleton) && ("There can be only one singleton")" failed'
I call OgreContext::initAppForAndroid() when open create the activity with ogre and call OgreContext::shutdown() on activity destroy. The Sample app reproduce the same same issue.
Which is the correct way to finish work with ogre? Am I should call initAppForAndroid() only once? And, if true, how cam I check is it initialized?
paroj
OGRE Team Member
Posts: 2151 Joined: Sun Mar 30, 2014 2:51 pm
x 1156
Post
by paroj » Mon Jan 21, 2019 1:49 pm
you have to call closeApp() instead of shutdown() - similarly to how initApp() calls setup()
overtired
Gnoblar
Posts: 14 Joined: Tue Oct 23, 2018 1:32 pm
x 1
Post
by overtired » Tue Jan 22, 2019 11:38 am
I tried to call closeApp(), but I lead to another error, I made the log below from the sample
Code: Select all
2019-01-22 13:36:23.119 2595-2595/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2019-01-22 13:36:23.119 2595-2595/? A/DEBUG: Build fingerprint: 'google/marlin/marlin:8.1.0/OPM4.171019.021.P1/4820305:user/release-keys'
2019-01-22 13:36:23.119 2595-2595/? A/DEBUG: Revision: '0'
2019-01-22 13:36:23.119 2595-2595/? A/DEBUG: ABI: 'arm'
2019-01-22 13:36:23.119 2595-2595/? A/DEBUG: pid: 2528, tid: 2528, name: mples.c.helloar >>> com.google.ar.core.examples.c.helloar <<<
2019-01-22 13:36:23.119 2595-2595/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x12
2019-01-22 13:36:23.119 2595-2595/? A/DEBUG: Cause: null pointer dereference
2019-01-22 13:36:23.120 2595-2595/? A/DEBUG: r0 cfdf27f4 r1 00000012 r2 00000000 r3 00000000
2019-01-22 13:36:23.120 2595-2595/? A/DEBUG: r4 cf590b20 r5 00000012 r6 cfdf27f8 r7 ff9dc6c8
2019-01-22 13:36:23.120 2595-2595/? A/DEBUG: r8 cfdf27f8 r9 cf58c0c0 sl dedc1940 fp ff9dc804
2019-01-22 13:36:23.120 2595-2595/? A/DEBUG: ip 0000006d sp ff9dc6b8 lr cfb0b77d pc cfb0c56a cpsr 60010030
2019-01-22 13:36:23.125 2595-2595/? A/DEBUG: backtrace:
2019-01-22 13:36:23.125 2595-2595/? A/DEBUG: #00 pc 004c956a /data/app/com.google.ar.core.examples.c.helloar-suvNkJivUP6bp_cKhVXrWA==/lib/arm/libOgreJNI.so
2019-01-22 13:36:23.125 2595-2595/? A/DEBUG: #01 pc 004c8779 /data/app/com.google.ar.core.examples.c.helloar-suvNkJivUP6bp_cKhVXrWA==/lib/arm/libOgreJNI.so
2019-01-22 13:36:23.125 2595-2595/? A/DEBUG: #02 pc 004c87f5 /data/app/com.google.ar.core.examples.c.helloar-suvNkJivUP6bp_cKhVXrWA==/lib/arm/libOgreJNI.so
2019-01-22 13:36:23.125 2595-2595/? A/DEBUG: #03 pc 003813a3 /data/app/com.google.ar.core.examples.c.helloar-suvNkJivUP6bp_cKhVXrWA==/lib/arm/libOgreJNI.so
2019-01-22 13:36:23.126 2595-2595/? A/DEBUG: #04 pc 00381455 /data/app/com.google.ar.core.examples.c.helloar-suvNkJivUP6bp_cKhVXrWA==/lib/arm/libOgreJNI.so
2019-01-22 13:36:23.126 2595-2595/? A/DEBUG: #05 pc 0043b693 /data/app/com.google.ar.core.examples.c.helloar-suvNkJivUP6bp_cKhVXrWA==/lib/arm/libOgreJNI.so
2019-01-22 13:36:23.126 2595-2595/? A/DEBUG: #06 pc 0030264b /data/app/com.google.ar.core.examples.c.helloar-suvNkJivUP6bp_cKhVXrWA==/lib/arm/libOgreJNI.so
2019-01-22 13:36:23.126 2595-2595/? A/DEBUG: #07 pc 002efd05 /data/app/com.google.ar.core.examples.c.helloar-suvNkJivUP6bp_cKhVXrWA==/lib/arm/libOgreJNI.so (Java_org_Ogre_OgreBitesJNI_ApplicationContext_1closeApp+12)
2019-01-22 13:36:23.127 2595-2595/? A/DEBUG: #08 pc 000109a3 /data/app/com.google.ar.core.examples.c.helloar-suvNkJivUP6bp_cKhVXrWA==/oat/arm/base.odex (offset 0x10000)
paroj
OGRE Team Member
Posts: 2151 Joined: Sun Mar 30, 2014 2:51 pm
x 1156
Post
by paroj » Tue Jan 22, 2019 3:55 pm
yeah.. I just noticed that our samples actually never call closeApp(), so that code is untested. Will take me some time to look at.
Alternatively you can do what the SampleBrowser does to detect whether the app is already running:
https://github.com/OGRECave/ogre/blob/m ... oid.h#L108