Signal 11 and Signal 10 Errors
Signal 11 and Signal 10 Errors
- Subject: Signal 11 and Signal 10 Errors
- From: Emiliano Farinella <email@hidden>
- Date: Fri, 19 Sep 2003 13:55:53 +0200
Dear Developers :)
this is my first message to this mailing list, so I suppose you will
appreciate a small (very small) presentation: I'm an Italian software
developer, usually I work as web application developer in PHP and JSP
(I'd like to work in Web Objects in the near future).
Now I'm working on a Cocoa Project in University of Palermo with a
partner.
The Cocoa Application: "stickIt!"
"stickIt!" is a small application based on Aqua Humane Interface
Guidelines. "stickIt!" is a friendly interface between the user and
iCal and AddressBook. You can take your notes about events, to do,
contacts in natural language. Our Application will work with iCal or
Address Book to make the right event, todo or contact.
"stickIt!" is based on an underground layer developed in Lex and Yacc
to understand natural language.
Now "stickIt!" can understand the subset of Italian language that we
use to take notes.
The problem: Signal 11 e Signal 10 Errors
We have misteriosus problems with Signal 11 e Signal 10 Errors :(
Sometimes our application crashes with a signal 10 (SIGBUS), sometimes
with signal 11 (SIGSGV).
We know the theorical reason of those signals... We know that
attempting to write to a nonexistent object will produce a Signal 11
segmentation violation, while attempting to retreive data from a
nonexistent object will result in a Signal 10 bus error... but we can't
find the - diabolic - bug!
I'm a bit worried that you would consider our problem a newbies
problem, and I would understand if your answer is 'RTFM'... but our
problem is that we don't understand why objects in manageToDo() give
signal 11 and signal 10 errors.
We'd like to know how we could deallocs without any crash...
We have launched our application in Debug mode and with Object Alloc,
we have read a lot of stuff about memory managment... but, still, we
don't see the light at the end of tunnel :/
We are going to release our first beta in GPL licence, so I can give
you the source of two classes. (Sorry, the message is over 8kb, so I
must cut a lot of code lines...)
If somebody would like to see all the project, I'll be glad to mail him
all the sources :)
Thank you very much for you attention and your tips! :)
Best wishes,
Emiliano Farinella
--
http://www.emiliano.farinella.org
Classes:
Controller.m
STDay.m
/* *********************** *
* CONTROLLER.M */
Some methods from Controller.m...
// Metodi di interfacciamento con iCal
- (void)createNewCalendar
{
NSLog(@"Gestione del To Do");
// Crea la stringa contenente il testo del file "create_new_cal.txt"
NSMutableString *scriptBody = [NSMutableString
stringWithContentsOfFile:[[NSBundle mainBundle]
pathForResource:@"create_new_cal" ofType:@"txt"]];
#ifndef GS_BLOCK_LOGS
NSLog(@"Ho preso la stringa contenente lo script:\n%@", scriptBody);
#endif
// Crea uno script Applescript e lo esegue
NSAppleScript *script = [[NSAppleScript alloc]
initWithSource:scriptBody];
NSDictionary *errorInfo = [NSDictionary dictionary];
NSAppleEventDescriptor *descriptor = [script
executeAndReturnError:&errorInfo];
[script release];
[errorInfo release];
[descriptor release];
}
- (void)manageToDo
{
// Crea la stringa contenente il testo del file
"make_todo_ical_template.txt"
NSMutableString *scriptBody = [NSMutableString
stringWithContentsOfFile:[[NSBundle mainBundle]
pathForResource:@"make_todo_ical_template" ofType:@"txt"]];
#ifndef GS_BLOCK_LOGS
NSLog(@"Ho preso la stringa contenente lo script:\n%@", scriptBody);
#endif
// Utilizza la data e l'ora attuale per lo script
STDay *now = [[STDay alloc] init];
STStick *lastStick = [stickies lastObject];
// Crea la substring toDoDate contenente il formato:"GG_start
MM_start AAAA_start HH_start:MN_start:00"
NSMutableString *toDoDate = [[NSMutableString alloc]
initWithString:@""];
[toDoDate appendString:[now description]];
[scriptBody replaceOccurrencesOfString:@"data_inizio"
withString:[[now STStartDate] descriptionWithCalendarFormat:@"%d %m %Y
%H:%M"] options:(NSCaseInsensitiveSearch) range:NSMakeRange(0,
[scriptBody length])];
[scriptBody replaceOccurrencesOfString:@"descrizione"
withString:[lastStick STInputText] options:(NSCaseInsensitiveSearch)
range:NSMakeRange(0, [scriptBody length])];
#ifndef GS_BLOCK_LOGS
NSLog(@"script modificato:\n%@", scriptBody);
#endif
// Crea uno script Applescript e lo esegue
NSAppleScript *script = [[NSAppleScript alloc]
initWithSource:scriptBody];
NSDictionary *errorInfo = [NSDictionary dictionary];
[script executeAndReturnError:&errorInfo];
#ifndef GS_BLOCK_LOGS
NSLog(@"Inizia il release degli oggetti\n");
#endif
// [now autorelease];
//#ifndef GS_BLOCK_LOGS
// NSLog(@"Release oggetto now OK!\n");
//#endif
// [lastStick autorelease];
//#ifndef GS_BLOCK_LOGS
// NSLog(@"Release oggetto lastStick OK!:\n");
//#endif
[script release];
#ifndef GS_BLOCK_LOGS
NSLog(@"Release oggetto script OK!\n");
#endif
[errorInfo release];
#ifndef GS_BLOCK_LOGS
NSLog(@"Release oggetto errorInfo OK!\n");
#endif
}
// Metodo di deallocazione per assicurarsi che tutta la memoria
utilizzata dall'array venga rilasciata
- (void)dealloc
{
#ifndef GS_BLOCK_LOGS
NSLog(@"Sto deallocando l'array stickies");
#endif
[stickies release];
[super release];
}
@end
Emiliano Farinella
--
http://www.emiliano.farinella.org
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.