Changeset 1512cf1a20070d45f764ecddb2d9620fbc374a49
- Timestamp:
- 25/06/08 20:59:53
(4 months ago)
- Author:
- Rémi Denis-Courmont <rdenis@simphalempin.com>
- git-committer:
- Rémi Denis-Courmont <rdenis@simphalempin.com> 1214420393 +0300
- git-parent:
[bd3008a3a1d7122b7fb738f3ea4844b742dc72c2]
- git-author:
- Rémi Denis-Courmont <rdenis@simphalempin.com> 1214420393 +0300
- Message:
Use QPointer and QMutexLocker so we don't crash at Qt4 interface exit
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rbd3008a |
r1512cf1 |
|
| 33 | 33 | #include <QMutexLocker> |
|---|
| 34 | 34 | #include <QWaitCondition> |
|---|
| | 35 | #include <QPointer> |
|---|
| 35 | 36 | |
|---|
| 36 | 37 | #include "qt4.hpp" |
|---|
| … | … | |
| 341 | 342 | p_intf->p_sys->b_isDialogProvider = false; |
|---|
| 342 | 343 | |
|---|
| 343 | | val.p_address = p_intf->p_sys->p_mi; |
|---|
| | 344 | val.p_address = new QPointer<MainInterface> (p_intf->p_sys->p_mi); |
|---|
| 344 | 345 | QMutexLocker locker (&windowLock); |
|---|
| 345 | 346 | var_Set (p_intf, "window_widget", val); |
|---|
| … | … | |
| 482 | 483 | } |
|---|
| 483 | 484 | |
|---|
| 484 | | MainInterface *mi = (MainInterface *)ptrval.p_address; |
|---|
| 485 | | msg_Dbg (obj, "requesting window (%p)...", mi); |
|---|
| 486 | | |
|---|
| 487 | | wnd->handle = mi->requestVideo (wnd->vout, &wnd->pos_x, &wnd->pos_y, |
|---|
| 488 | | &wnd->width, &wnd->height); |
|---|
| | 485 | msg_Dbg (obj, "requesting window..."); |
|---|
| | 486 | QPointer<MainInterface> *miP = (QPointer<MainInterface> *)ptrval.p_address; |
|---|
| | 487 | ptrval.p_address = NULL; |
|---|
| | 488 | /* take ownership */ |
|---|
| | 489 | var_Set (intf, "window_widget", ptrval); |
|---|
| | 490 | vlc_object_release (intf); |
|---|
| | 491 | |
|---|
| | 492 | if (miP->isNull ()) |
|---|
| | 493 | return VLC_EGENERIC; |
|---|
| | 494 | |
|---|
| | 495 | wnd->handle = (*miP)->requestVideo (wnd->vout, &wnd->pos_x, &wnd->pos_y, |
|---|
| | 496 | &wnd->width, &wnd->height); |
|---|
| 489 | 497 | windowLock.unlock (); |
|---|
| 490 | 498 | wnd->control = ControlWindow; |
|---|
| 491 | | wnd->p_private = intf; |
|---|
| | 499 | wnd->p_private = miP; |
|---|
| 492 | 500 | return VLC_SUCCESS; |
|---|
| 493 | 501 | } |
|---|
| … | … | |
| 495 | 503 | static int ControlWindow (vout_window_t *wnd, int query, va_list args) |
|---|
| 496 | 504 | { |
|---|
| 497 | | intf_thread_t *intf = (intf_thread_t *)wnd->p_private; |
|---|
| 498 | | intf->p_sys->p_mi->controlVideo (wnd->handle, query, args); |
|---|
| | 505 | QPointer<MainInterface> *miP = (QPointer<MainInterface> *)wnd->p_private; |
|---|
| | 506 | QMutexLocker locker (&windowLock); |
|---|
| | 507 | |
|---|
| | 508 | if (miP->isNull ()) |
|---|
| | 509 | return VLC_EGENERIC; |
|---|
| | 510 | return (*miP)->controlVideo (wnd->handle, query, args); |
|---|
| 499 | 511 | } |
|---|
| 500 | 512 | |
|---|
| … | … | |
| 502 | 514 | { |
|---|
| 503 | 515 | vout_window_t *wnd = (vout_window_t *)obj; |
|---|
| 504 | | intf_thread_t *intf = (intf_thread_t *)obj->p_private; |
|---|
| 505 | | |
|---|
| 506 | | intf->p_sys->p_mi->releaseVideo (wnd->handle); |
|---|
| 507 | | vlc_object_release (intf); |
|---|
| 508 | | } |
|---|
| 509 | | |
|---|
| | 516 | QPointer<MainInterface> *miP = (QPointer<MainInterface> *)wnd->p_private; |
|---|
| | 517 | QMutexLocker locker (&windowLock); |
|---|
| | 518 | |
|---|
| | 519 | if (!miP->isNull ()) |
|---|
| | 520 | (*miP)->releaseVideo (wnd->handle); |
|---|
| | 521 | delete miP; |
|---|
| | 522 | } |
|---|