Observe notification from a static object?

Hi everybody,

i am trying to build a panel window. The panel is supposed to be opened from a document window.
And i use a static window controller object to open the panel.

I want the document window to be able to hear the NSWindowWillCloseNotification only send from the
static panel window controller. The code is shown below:

When the app runs, the document cannot hear the notification.
If no object is passed (instead of p, i use nil) the document hears
the notification, but at the same time it hears NSWindowWillCloseNotification
from other documents also. A behavior i do not want.

Is the static object the problem?

I found where my error was.

NSWindowWillClose notification is a NSWindow notification and not
a NSWindowController notification.

So, static object can be added as notification senders.

So the observer must be added like that (change in bold):