firebase/quickstart-cpp

Crash when using remote_config::SetDefaults

larpon opened this issue · 2 comments

I'm using the latest version 4.1.0

When using:
remote_config::SetDefaults(defaults.get(), filteredMap.size());

I get a crash on iOS:

2017-08-28 12:53:32.866634+0200 App[675:250041] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: key cannot be nil'

*** First throw call stack:

(0x188e5afe0 0x1878bc538 0x188d3e528 0x100215bf8 0x10006340c 0x100062654 0x100073cd0 0x100074444 0x10174b930 0x100f05838 0x100e30ad8 0x100e2f844 0x100e2f448 0x100e2ef58 0x100e91c0c 0x100e4cd18 0x100e4621c 0x100e4abd0 0x100d7762c 0x100f32680 0x100e9d810 0x100e9de1c 0x100f0d42c 0x100e65f00 0x101789838 0x10178975c 0x100074168 0x100060910 0x100061f9c 0x10005fe28 0x100064728 0x100064620 0x100064514 0x10178d0d0 0x10178a070 0x10178975c 0x10006e9c8 0x100045484 0x100047908 0x100047820 0x1000476cc 0x10178d0d0 0x10178a070 0x10178975c 0x10179b580 0x10179b51c 0x101782ed4 0x101742368 0x101741f28 0x101741f9c 0x100ff8720 0x101741e28 0x1002f8920 0x1017d6da8 0x10181e1c8 0x10181ea60 0x188e09aa4 0x188e097a8 0x188e09068 0x188e06c8c 0x188d36da4 0x18a7a1074 0x18eff1c9c 0x1002d1f4c 0x187d4559c)

libc++abi.dylib: terminating with uncaught exception of type NSException

I'm guessing that something unexpected gets passed in remote_config::SetDefaults(); but the same code runs flawlessly on Android?

Hi @larpon is there any chance you could share the exact code you're running? i.e what's defaults.get() and filteredMap.size() in this case? Can you reproduce the problem with our remote config sample?

It was wrong use of Qt.

After investigating further I found that the code was passing in char pointers that weren't guaranteed to remain valid after first call.

I've fixed it so the string are now kept in a QByteArray until next call to remote_config::SetDefaults()