exc-bad-access

EXC_BAD_ACCESS at main method declaration

六月ゝ 毕业季﹏ 提交于 2021-02-11 18:03:50
问题 I'm trying to get some old C++ code up and running. I've gotten it to compile without error, but it immediately segfaults when I run, without entering main. When I use gdb to find out where things are going wrong, I find the following: (gdb) run Starting program: /Users/dreens/Documents/OH/extrabuncher2/ParaOHSB Reading symbols for shared libraries +++. done Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x00007fff5636581c

Why does this use of std::transform cause exc_bad_access

好久不见. 提交于 2021-01-28 00:57:54
问题 I have this code (roughly) in a cpp app: QList<Foo> rawAssets = getlist(); QVector<std::pair<QString, QString>> assets; std::transform(rawAssets.begin(), rawAssets.end(), assets.begin(), makePair); That causes exc_bad_access to throw when I use assets again. However, if I change assets.begin() to std::back_inserter(assets) then it works as I expect. I found tutorials for std::transform showing both kinds of usage. Why is it wrong in my case? 回答1: Since you've just declared QVector<std::pair

EXC_BAD_ACCESS(code=1, address=0x0) occurs when passing a std::map as parameter to a virtual function call

风格不统一 提交于 2020-04-18 07:34:12
问题 I have a class that has the following virtual function namespace Book { class Secure { virtual Result setPassword(const std::map<std::string, std::vector<std::string> >& params)=0; } } I have another test class in which a method gets the password and user name from the excel and sets it to the map secureParams and sets the password for the current file. bool initialize(std::string bookPath, std::string loginPath, std::string userName, std::string password) { Book::SharedPtr<Book::Secure>

Tracking down EXC_BAD_ACCESS without NSZombie?

时间秒杀一切 提交于 2020-01-25 01:22:16
问题 I've spent two days on this and I still can't find the cause of the crash. I know it has something to do with trying to access an object that has been freed but I don't know which access or which object. Whenever I google trying to find the source of EXC_BAD_ACCESS people suggest using NSZombies. The problem is when I enable zombies (either in xcode via environment variable or in instruments via ObjectAlloc properties) the program doesn't crash where it usually does and the zombies don't

EXC_BAD_ACCESS when copying or retaining Block

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-19 05:20:07
问题 As far as I understand a Block acts like an object, in that you can send copy or release messages to it, e.g: [myBlock copy]; However whenever I do this, or release a block, I get EXC_BAD_ACCESS. If I use the block functions, everything works as expected, e.g.: Block_copy(myBlock); I thought both ways of releasing and copying blocks were identical? It's not that much of a problem, but it is a little annoying that if I have a property (copy) which is a Block, I have to write the setter method

Swift: self.init (coder : aDecoder) is crashing app with EXC_BAD_ACCESS

徘徊边缘 提交于 2020-01-17 06:46:35
问题 Error is crashing app when using NSCoder and NSKeyArchiver. I had made a recent post around NSCoder but since then I've changed my code around and got a new error and decided a new post is best. The app is a blog reader, reading from a MYSQL database using PHP to fill a table view with custom objects in Swift using JSON. I've been trying to save mainArray so that when the user moves cells across sections (each section has an array) it can save where the user left it. Blog.swift: Handles the

ASIHTTPRequest dealloc and EXC_BAD_ACCESS problem

為{幸葍}努か 提交于 2020-01-13 19:28:37
问题 I'm using an array of ASIHTTPRequest wrappers (AsyncImageLoader) to download images for cells in a UITableView. I'm having problems handling ASIHTTPRequests lifetime. If I release them, I end up having a EXC_BAD_ACCESS if I keep scrolling up and down while they try to load images. Here's what my wrapper looks like. self.request has retain property, targetCell is the cell I want to put the image in: @implementation AsyncImageLoader - (void)loadImageFromURL:(NSString*)fileName target:

UIButton EXC_BAD_ACCESS error

不问归期 提交于 2020-01-06 18:37:08
问题 I have an UI button and it works correctly when I pressed. But if I press the button three times, I get an EXc_BAD_ACCESS error. I thought I release something in somewhere but I couldn't find the solution. Could you please help me? Kind regards. This is the function when I pressed the button. And in dealloc I release them. When I am tracking, it doesn't give the error in function. I got it after function, but I dont know where the code goes after this function. - (IBAction) doSomething: (id

I am getting EXC_BAD_ACCESS (code=1, address=0x30) Bad Access even when object exists - swift 4

风流意气都作罢 提交于 2020-01-06 07:26:14
问题 Similar to This SO Post and This SO Post I initialize a variable ----> idHERE: static func createPractitionerRole(fromRoleDict roleDict:[String: AnyObject])->PractitionerRole?{ guard let (nameL, idL) = getRoleNameId(fromRoleDict:roleDict) else { return nil } let roleTypeL = ProTouchRoleType.determineRoleTypeFromProTouchId(idL) var idHERE = Identifier(withValue: idL, systemParam:Constants.CodeSystem.ProTouch.coding_system_proTouchURL) print("idHERE \(String(describing: idHERE))") print("idHERE

What should I do to call audioPlayerDidFinishPlaying:

て烟熏妆下的殇ゞ 提交于 2020-01-06 05:40:10
问题 I wrote this source program . But I can't call audioPlayerDidFinishPlaying: method. After playing the sound, which crashes by "exc_bad_access" error after a few seconds. .h file #import <UIKit/UIKit.h> #import <AVFoundation/AVFoundation.h> @interface SecondViewController : UIViewController< AVAudioPlayerDelegate>{ AVAudioPlayer *aPlayer; } @end .m file -(void)playSound{ NSString *soundName = @"red"; NSError *error = nil; NSURL *soundUrl = [[NSBundle mainBundle] URLForResource:soundName