- /* FIXME A condition variable would be way more appropriate. */
- msleep (INTF_IDLE_SLEEP);
- } while (ptrval.p_address == NULL);
-
- msg_Dbg (obj, "requestiong window...");
- MainInterface *mi = (MainInterface *)ptrval.p_address;
-
- wnd->handle = mi->requestVideo (wnd->vout, &wnd->pos_x, &wnd->pos_y,
- &wnd->width, &wnd->height);
- vlc_mutex_unlock ((vlc_mutex_t *)lockval.p_address);
- wnd->control = ControlWindow;
- wnd->p_private = intf;
+ if (ptrval.p_address != NULL)
+ break;
+ windowWait.wait (&windowLock);
+ }
+
+ msg_Dbg (obj, "requesting window...");
+ QPointer<MainInterface> *miP = (QPointer<MainInterface> *)ptrval.p_address;
+ miP = new QPointer<MainInterface> (*miP); /* create our own copy */
+ vlc_object_release (intf);
+
+ if (miP->isNull ())
+ return VLC_EGENERIC;
+
+ wnd->handle = (*miP)->requestVideo (wnd->vout, &wnd->pos_x, &wnd->pos_y,
+ &wnd->width, &wnd->height);
+ windowLock.unlock ();
+ wnd->control = WindowControl;
+ wnd->p_private = miP;