Skip to content

Commit

Permalink
Merge pull request #305 from bugsnag/next
Browse files Browse the repository at this point in the history
v5.16.3
  • Loading branch information
fractalwrench authored Aug 14, 2018
2 parents 59dc4d7 + e0dee22 commit 3cee5b9
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 121 deletions.
4 changes: 2 additions & 2 deletions Bugsnag.podspec.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Bugsnag",
"version": "5.16.2",
"version": "5.16.3",
"summary": "Cocoa notifier for SDK for bugsnag.com",
"homepage": "https://bugsnag.com",
"license": "MIT",
Expand All @@ -9,7 +9,7 @@
},
"source": {
"git": "https://github.com/bugsnag/bugsnag-cocoa.git",
"tag": "v5.16.2"
"tag": "v5.16.3"
},
"frameworks": ["Foundation", "SystemConfiguration"],
"libraries": [
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

## 5.16.3 (14 Aug 2018)

### Bug Fixes

* Deregister notification observers and listeners before application termination [#301](https://github.com/bugsnag/bugsnag-cocoa/pull/301)

## 5.16.2 (17 Jul 2018)

### Bug fixes
Expand Down
34 changes: 30 additions & 4 deletions Source/BugsnagNotifier.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#import <AppKit/AppKit.h>
#endif

NSString *const NOTIFIER_VERSION = @"5.16.2";
NSString *const NOTIFIER_VERSION = @"5.16.3";
NSString *const NOTIFIER_URL = @"https://github.com/bugsnag/bugsnag-cocoa";
NSString *const BSTabCrash = @"crash";
NSString *const BSAttributeDepth = @"depth";
Expand Down Expand Up @@ -308,12 +308,13 @@ - (void)start {
onCrash:&BSSerializeDataCrashHandler];
[self setupConnectivityListener];
[self updateAutomaticBreadcrumbDetectionSettings];

NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[self watchLifecycleEvents:center];

#if TARGET_OS_TV
[self.details setValue:@"tvOS Bugsnag Notifier" forKey:BSGKeyName];
[self addTerminationObserver:UIApplicationWillTerminateNotification];

#elif TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
[self.details setValue:@"iOS Bugsnag Notifier" forKey:BSGKeyName];
Expand Down Expand Up @@ -343,6 +344,8 @@ - (void)start {

[self batteryChanged:nil];
[self orientationChanged:nil];
[self addTerminationObserver:UIApplicationWillTerminateNotification];

#elif TARGET_OS_MAC
[self.details setValue:@"OSX Bugsnag Notifier" forKey:BSGKeyName];

Expand All @@ -355,6 +358,8 @@ - (void)start {
selector:@selector(willEnterBackground:)
name:NSApplicationDidResignActiveNotification
object:nil];

[self addTerminationObserver:NSApplicationWillTerminateNotification];
#endif

_started = YES;
Expand All @@ -364,18 +369,39 @@ - (void)start {
[self willEnterForeground:self];
}

- (void)addTerminationObserver:(NSString *)name {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(unsubscribeFromNotifications:)
name:name
object:nil];
}

/**
* Removes observers and listeners to prevent allocations when the app is terminated
*/
- (void)unsubscribeFromNotifications:(id)sender {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[self.networkReachable stopWatchingConnectivity];

#if TARGET_OS_TV || TARGET_OS_MAC
#elif TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
[UIDevice currentDevice].batteryMonitoringEnabled = NO;
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
#endif
}

- (void)watchLifecycleEvents:(NSNotificationCenter *)center {
NSString *foregroundName;
NSString *backgroundName;

#if TARGET_OS_TV || TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
foregroundName = UIApplicationWillEnterForegroundNotification;
backgroundName = UIApplicationWillEnterForegroundNotification;
#elif TARGET_OS_MAC
foregroundName = NSApplicationWillBecomeActiveNotification;
backgroundName = NSApplicationDidFinishLaunchingNotification;
#endif

[center addObserver:self
selector:@selector(willEnterForeground:)
name:foregroundName
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.16.2
5.16.3
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,6 @@
F40B874316AA233500676BB2 /* Frameworks */,
F40B874416AA233500676BB2 /* Resources */,
5142A2F8286744A694BDB5BA /* Upload Bugsnag dSYM */,
765F7485E02A01DA5E42AC27 /* [CP] Embed Pods Frameworks */,
E142138E1656CA8499F1E0A3 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -409,36 +407,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
765F7485E02A01DA5E42AC27 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Bugsnag Test App/Pods-Bugsnag Test App-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
E142138E1656CA8499F1E0A3 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Bugsnag Test App/Pods-Bugsnag Test App-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down
8 changes: 4 additions & 4 deletions examples/objective-c-ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
PODS:
- Bugsnag (5.15.3)
- Bugsnag (5.16.0)

DEPENDENCIES:
- Bugsnag (from `../..`)

EXTERNAL SOURCES:
Bugsnag:
:path: ../..
:path: "../.."

SPEC CHECKSUMS:
Bugsnag: 49464c6c2fb7a2eb5a66064586c64a6e23454c04
Bugsnag: 47bcc70b43e3c616ec35d30c2ca94497b957199f

PODFILE CHECKSUM: 4c48f26cc704429f747c4af7a40e026b20fdc83e

COCOAPODS: 1.4.0
COCOAPODS: 1.5.0
8 changes: 4 additions & 4 deletions examples/objective-c-osx/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
PODS:
- Bugsnag (5.14.1)
- Bugsnag (5.16.0)

DEPENDENCIES:
- Bugsnag (from `../..`)

EXTERNAL SOURCES:
Bugsnag:
:path: ../..
:path: "../.."

SPEC CHECKSUMS:
Bugsnag: bc62bf437f55cfae29a4c836f29f9e8b64af3457
Bugsnag: 47bcc70b43e3c616ec35d30c2ca94497b957199f

PODFILE CHECKSUM: df3de31179198c85e1d68a7930eb894bbeb22744

COCOAPODS: 1.3.1
COCOAPODS: 1.5.0
32 changes: 0 additions & 32 deletions examples/objective-c-osx/objective-c-osx.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@
93BE1CCC1B62CC360016380C /* Frameworks */,
93BE1CCD1B62CC360016380C /* Resources */,
D24AA2BFC04EE1A1916426C8 /* Upload Bugsnag dSYM */,
3B550964C9496E4003E11717 /* [CP] Embed Pods Frameworks */,
2DB50B6F565C5C917EEF01B4 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -252,36 +250,6 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
2DB50B6F565C5C917EEF01B4 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-objective-c-osx/Pods-objective-c-osx-resources.sh\"\n";
showEnvVarsInLog = 0;
};
3B550964C9496E4003E11717 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-objective-c-osx/Pods-objective-c-osx-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
AF12CC88EC2DA5EF6D40C883 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down
32 changes: 0 additions & 32 deletions examples/swift-ios/bugsnag-example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@
D175F4B51ACDBD81009AFFB7 /* Frameworks */,
D175F4B61ACDBD81009AFFB7 /* Resources */,
9AFEEED933DC82BFDDB374F6 /* Upload Bugsnag dSYM */,
C54E80312CD2DFF73A2EEB6C /* [CP] Embed Pods Frameworks */,
AF034E316E834BBEE8E209A4 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -295,36 +293,6 @@
shellScript = "fork do\n Process.setsid\n STDIN.reopen(\"/dev/null\")\n STDOUT.reopen(\"/dev/null\", \"a\")\n STDERR.reopen(\"/dev/null\", \"a\")\n\n require 'shellwords'\n\n Dir[\"#{ENV[\"DWARF_DSYM_FOLDER_PATH\"]}/*/Contents/Resources/DWARF/*\"].each do |dsym|\n system(\"curl -F dsym=@#{Shellwords.escape(dsym)} -F projectRoot=#{Shellwords.escape(ENV[\"PROJECT_DIR\"])} https://upload.bugsnag.com/\")\n end\nend\n";
showEnvVarsInLog = 0;
};
AF034E316E834BBEE8E209A4 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-bugsnag-example/Pods-bugsnag-example-resources.sh\"\n";
showEnvVarsInLog = 0;
};
C54E80312CD2DFF73A2EEB6C /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-bugsnag-example/Pods-bugsnag-example-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down
27 changes: 17 additions & 10 deletions features/steps/crash_assertion_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,23 @@
when "_nc_table_find_64"
assert_equal(exception["errorClass"], "SIGSEGV")
assert_equal(exception["message"], "Attempted to dereference null pointer.")
assert_equal(stacktrace[1]["method"], "notify_check")
assert_equal(stacktrace[2]["method"], "notify_check_tz")
assert_equal(stacktrace[3]["method"], "tzsetwall_basic")
assert_equal(stacktrace[4]["method"], "localtime_r")
assert_equal(stacktrace[5]["method"], "_populateBanner")
assert_equal(stacktrace[6]["method"], "_CFLogvEx2Predicate")
assert_equal(stacktrace[7]["method"], "_CFLogvEx3")
assert_equal(stacktrace[8]["method"], "_NSLogv")
assert_equal(stacktrace[9]["method"], "NSLog")
assert_equal(stacktrace[10]["method"], "-[CorruptMallocScenario run]")

frame = 1

if stacktrace[frame]["method"] == "registration_node_find"
frame = 2
end

assert_equal(stacktrace[frame]["method"], "notify_check")
assert_equal(stacktrace[frame + 1]["method"], "notify_check_tz")
assert_equal(stacktrace[frame + 2]["method"], "tzsetwall_basic")
assert_equal(stacktrace[frame + 3]["method"], "localtime_r")
assert_equal(stacktrace[frame + 4]["method"], "_populateBanner")
assert_equal(stacktrace[frame + 5]["method"], "_CFLogvEx2Predicate")
assert_equal(stacktrace[frame + 6]["method"], "_CFLogvEx3")
assert_equal(stacktrace[frame + 7]["method"], "_NSLogv")
assert_equal(stacktrace[frame + 8]["method"], "NSLog")
assert_equal(stacktrace[frame + 9]["method"], "-[CorruptMallocScenario run]")
else
fail("The exception does not reflect malloc corruption")
end
Expand Down

0 comments on commit 3cee5b9

Please sign in to comment.