PDA

View Full Version : Crash- pointer being freed was not allocated. Easily reproduce in virtually empty app



jimt2000
06.01.2016, 02:05
A Very simple app crashes

MapApp(70799,0x10cc7e000) malloc: *** error for object 0x7faf4c404e80: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

I would attach sample project but can't attach a large file. I have duplicated the problem in multiple apps.
See the steps to duplicate below.

This is causing us a major hurdle in that we cannot run our automated tests.

The app only crashes when using SKMapView.

Stack Trace:


#0 0x000000010ccb1002 in __pthread_kill ()
#1 0x000000010cc775c5 in pthread_kill ()
#2 0x000000010ca17cec in abort ()
#3 0x000000010cb35b92 in free ()
#4 0x0000000108b7e41d in std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int>, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int> > >::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int>, void*>*) ()
#5 0x0000000108b7e41d in std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int>, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int> > >::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int>, void*>*) ()
#6 0x0000000108be2728 in opengl::GLProgram::~GLProgram() ()
#7 0x0000000108bd4e20 in opengl::detail::GLStateMachine::~GLStateMachine() ()
#8 0x000000010ca18a5d in __cxa_finalize_ranges ()
#9 0x000000010ca18d8c in exit ()
#10 0x00000001156690cd in ___XCTestMain_block_invoke ()
#11 0x000000011561f128 in -[XCTestDriver _runSuite] ()
#12 0x000000011561fe2c in -[XCTestDriver _checkForTestManager] ()
#13 0x0000000115668e99 in _XCTestMain ()
#14 0x0000000109dc6a1c in __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ ()
#15 0x0000000109dbc6a5 in __CFRunLoopDoBlocks ()
#16 0x0000000109dbbe02 in __CFRunLoopRun ()
#17 0x0000000109dbb828 in CFRunLoopRunSpecific ()
#18 0x000000010e43bad2 in GSEventRunModal ()
#19 0x000000010a8df610 in UIApplicationMain ()
#20 0x00000001087ab78d in main at /Users/.../Dev/Projects/BugReports/MapApp/MapApp/AppDelegate.swift:12
#21 0x000000010c97192d in start ()


Steps to duplicate:

Create new project called MapApp. Choose swift as the language. Include tests.
Create Podfile ind project directory (sibling to MapApp.xcodeproj) with contents:
source 'https://github.com/CocoaPods/Specs.git'
pod 'ScoutMaps-iOS-SDK', '~>2.5'
pod 'ZipArchive', '~>1.4'
target 'MapAppTests' do
pod 'ScoutMaps-iOS-SDK', '~>2.5'
pod 'ZipArchive', '~>1.4'
end
Run "pod install"
Open MapApp.xcworkspace
Add a bridging header file and #import &lt;SKMaps/SKMaps.h&gt;
Within project, open Main.storyboard
Add a UIView as a child to the main view of the view controller.
In the indentity inspector, set the class name of the view you just added to SKMapView
Open AppDelegate.swift
Add these lines to application:didFinishingLaunchingWithOptions: using a valid key.
let settings = SKMapsInitSettings()
SKMapsService.sharedInstance().initializeSKMapsWit hAPIKey("xxxxxxxxxxxxxxxxxxxxxxxx", settings: settings)
Run the app. See the map appear.
run the tests (cmd-U)


See that when the empty tests complete, they crash. They do not crash if you do not use SKMapView.

gabri15
11.01.2016, 15:11
+1 on this. Talked about this in other thread in the forum and got no fix for this, altough in real-execution environment doesn't seem to make the app crash, only to send that traceback...

jimt2000
12.01.2016, 19:54
Our problem is that we can't get to a real execution environment because it fails in the test environment.

Adela_Silvia
19.01.2016, 14:53
This issue was fixed by our development team and will be available in the next SDK release

jimt2000
19.01.2016, 16:59
That's great news! Is there a way that we will be notified when the release becomes available?

Adela_Silvia
20.01.2016, 13:13
Each time we have a new release, we send a newsletter to our users and we share the news on our blog http://sdkblog.skobbler.com/