workspaceWillPowerOff error in Panther

  • Hi all,

    I am implementing cocoa application in which I am hidding its dock icon
    using info.plist.
    I have implemented code for catching shutdown/restart/logout event using *
    workspaceWillPowerOff* delegate & application quit event(quitting from
    activity monitor) using *applicationShouldTerminate *delegate.
    In Tiger, when I run that application; I am able to catch
    shutdown/restart/logout & application quit seperately & as I want. But in
    Panther, when I quit that application from activity monitor, both*
    **applicationShouldTerminate
    & **workspaceWillPowerOff *delegate methods gets called which is unexpected
    because ideally only *applicationShouldTerminate *should only get &
    not *workspaceWillPowerOff.

    *I also tried signal handling but they did not work in Panther (but very
    well in Leopard). So not useful.

    Any solution to capture quit event for background cocoa application??

    Thanks,
    Palav

    --

    There are many things in your life that will catch your eye but only a few
    will catch your heart....pursue those'.
  • Hi Willian,

    Thanks for reply.

    I want to catch the both delegates in my application which will
    execute two different segments of code (i.e. if user has quit the
    application from activity monitor then one segment of code will be
    called and if user has shutdown the mac then other segment of code
    will be called). Sequence of calling of delegates is fist
    "workspacewillpoweroff" gets called & then
    "applicationshouldterminate" in both the cases(i.e. application quit &
    machine shutdown). Bcoz of this, only code segment for shutdown is
    only becoming effective but not application quit which is my problem.
    Or I may be missing something which u r saying,

    Thanks,
    Palav

    On 1/21/08, William Squires <wsquires...> wrote:
    > How about a semaphore? Whichever delegate gets called first checks
    > the semaphore. If it hasn't been raised, it raises it, does its
    > thing, then lowers it. If the other delegate also gets called, it
    > sees the semaphore has been raised, and returns immediately. If the
    > other delegate does not fire, then no prob, the work still gets done
    > by the delegate that does fire.
    >
    > On Jan 17, 2008, at 10:18 AM, parag vibhute wrote:
    >
    >> Hi all,
    >>
    >> I am implementing cocoa application in which I am hidding its dock
    >> icon
    >> using info.plist.
    >> I have implemented code for catching shutdown/restart/logout event
    >> using *
    >> workspaceWillPowerOff* delegate & application quit event(quitting from
    >> activity monitor) using *applicationShouldTerminate *delegate.
    >> In Tiger, when I run that application; I am able to catch
    >> shutdown/restart/logout & application quit seperately & as I want.
    >> But in
    >> Panther, when I quit that application from activity monitor, both*
    >> **applicationShouldTerminate
    >> & **workspaceWillPowerOff *delegate methods gets called which is
    >> unexpected
    >> because ideally only *applicationShouldTerminate *should only get &
    >> not *workspaceWillPowerOff.
    >>
    >> *I also tried signal handling but they did not work in Panther (but
    >> very
    >> well in Leopard). So not useful.
    >>
    >> Any solution to capture quit event for background cocoa application??
    >>
    >> Thanks,
    >> Palav
    >>
    >> --
    >>
    >> There are many things in your life that will catch your eye but
    >> only a few
    >> will catch your heart....pursue those'.
    >
    >

    --

    There are many things in your life that will catch your eye but only a
    few will catch your heart....pursue those'.
previous month january 2008 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today