• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Loading NIB file from forked process
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Loading NIB file from forked process


  • Subject: Loading NIB file from forked process
  • From: Mark Allan <email@hidden>
  • Date: Sat, 12 Feb 2005 03:58:17 +0000

Hi there,

I've got a program which I'm writing in Objective-C, however, I originally wrote it in ANSI C as I didn't know Obj-C at the time, so there are still swathes of C code left in it. This is my first project in Objective-C, so please bear with me.

Within one of my Obj-C methods I'm forking off a child process so that I can do various tasks without blocking the GUI. Depending on the outcome of these tasks, I need to display a dialog box. The problem is that the NIB file doesn't load and consequently the dialog doesn't appear.

If I place the code to show the window before the scope of the forked process (ie before I call fork() ), it all works fine, otherwise it crashes the child process.

The code I've got looks something like this (greatly simplified!):

-(IBAction)startWatcher:(id)sender
{
[stopMenuItem setEnabled:true];
[startMenuItem setEnabled:false];

int watcherProcessID = fork();
if(watcherProcessID==0){
//perform various unrelated tasks and if necessary do the following
virusWarningWindowController *newWindow = [virusWarningWindowController initialize];
[NSBundle loadNibNamed:@"FoundVirusWarning" owner:newWindow];
printf("this line never gets reached\n");
}
}


Can anyone tell me how to display the dialog box from the child process please?

Many thanks,
Mark

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Loading NIB file from forked process
      • From: Finlay Dobbie <email@hidden>
  • Prev by Date: Re: Converting string equation to int
  • Next by Date: Re: Binding userdefaults update
  • Previous by thread: Re: A few questions about Memory Management
  • Next by thread: Re: Loading NIB file from forked process
  • Index(es):
    • Date
    • Thread