* src/nsterm.m (x_set_parent_frame): If the NSWindow has an existing
parent frame, remove it.
if (p != FRAME_PARENT_FRAME (f))
{
- parent = [FRAME_NS_VIEW (p) window];
+ block_input ();
child = [FRAME_NS_VIEW (f) window];
- block_input ();
- [parent addChildWindow: child
- ordered: NSWindowAbove];
+ if ([child parentWindow] != nil)
+ [[child parentWindow] removeChildWindow:child];
+
+ if (!NILP (new_value))
+ {
+ parent = [FRAME_NS_VIEW (p) window];
+
+ [parent addChildWindow: child
+ ordered: NSWindowAbove];
+ }
+
unblock_input ();
fset_parent_frame (f, new_value);