Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
1512cf1a
Commit
1512cf1a
authored
Jun 25, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use QPointer and QMutexLocker so we don't crash at Qt4 interface exit
parent
bd3008a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
12 deletions
+25
-12
modules/gui/qt4/qt4.cpp
modules/gui/qt4/qt4.cpp
+25
-12
No files found.
modules/gui/qt4/qt4.cpp
View file @
1512cf1a
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#include <QMutex>
#include <QMutex>
#include <QMutexLocker>
#include <QMutexLocker>
#include <QWaitCondition>
#include <QWaitCondition>
#include <QPointer>
#include "qt4.hpp"
#include "qt4.hpp"
#include "dialogs_provider.hpp"
#include "dialogs_provider.hpp"
...
@@ -340,7 +341,7 @@ static void Init( intf_thread_t *p_intf )
...
@@ -340,7 +341,7 @@ static void Init( intf_thread_t *p_intf )
p_mi->show(); */
p_mi->show(); */
p_intf
->
p_sys
->
b_isDialogProvider
=
false
;
p_intf
->
p_sys
->
b_isDialogProvider
=
false
;
val
.
p_address
=
p_intf
->
p_sys
->
p_mi
;
val
.
p_address
=
new
QPointer
<
MainInterface
>
(
p_intf
->
p_sys
->
p_mi
)
;
QMutexLocker
locker
(
&
windowLock
);
QMutexLocker
locker
(
&
windowLock
);
var_Set
(
p_intf
,
"window_widget"
,
val
);
var_Set
(
p_intf
,
"window_widget"
,
val
);
windowWait
.
wakeAll
();
windowWait
.
wakeAll
();
...
@@ -481,29 +482,41 @@ static int OpenWindow (vlc_object_t *obj)
...
@@ -481,29 +482,41 @@ static int OpenWindow (vlc_object_t *obj)
windowWait
.
wait
(
&
windowLock
);
windowWait
.
wait
(
&
windowLock
);
}
}
MainInterface
*
mi
=
(
MainInterface
*
)
ptrval
.
p_address
;
msg_Dbg
(
obj
,
"requesting window..."
);
msg_Dbg
(
obj
,
"requesting window (%p)..."
,
mi
);
QPointer
<
MainInterface
>
*
miP
=
(
QPointer
<
MainInterface
>
*
)
ptrval
.
p_address
;
ptrval
.
p_address
=
NULL
;
/* take ownership */
var_Set
(
intf
,
"window_widget"
,
ptrval
);
vlc_object_release
(
intf
);
if
(
miP
->
isNull
())
return
VLC_EGENERIC
;
wnd
->
handle
=
mi
->
requestVideo
(
wnd
->
vout
,
&
wnd
->
pos_x
,
&
wnd
->
pos_y
,
wnd
->
handle
=
(
*
miP
)
->
requestVideo
(
wnd
->
vout
,
&
wnd
->
pos_x
,
&
wnd
->
pos_y
,
&
wnd
->
width
,
&
wnd
->
height
);
&
wnd
->
width
,
&
wnd
->
height
);
windowLock
.
unlock
();
windowLock
.
unlock
();
wnd
->
control
=
ControlWindow
;
wnd
->
control
=
ControlWindow
;
wnd
->
p_private
=
intf
;
wnd
->
p_private
=
miP
;
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
static
int
ControlWindow
(
vout_window_t
*
wnd
,
int
query
,
va_list
args
)
static
int
ControlWindow
(
vout_window_t
*
wnd
,
int
query
,
va_list
args
)
{
{
intf_thread_t
*
intf
=
(
intf_thread_t
*
)
wnd
->
p_private
;
QPointer
<
MainInterface
>
*
miP
=
(
QPointer
<
MainInterface
>
*
)
wnd
->
p_private
;
intf
->
p_sys
->
p_mi
->
controlVideo
(
wnd
->
handle
,
query
,
args
);
QMutexLocker
locker
(
&
windowLock
);
if
(
miP
->
isNull
())
return
VLC_EGENERIC
;
return
(
*
miP
)
->
controlVideo
(
wnd
->
handle
,
query
,
args
);
}
}
static
void
CloseWindow
(
vlc_object_t
*
obj
)
static
void
CloseWindow
(
vlc_object_t
*
obj
)
{
{
vout_window_t
*
wnd
=
(
vout_window_t
*
)
obj
;
vout_window_t
*
wnd
=
(
vout_window_t
*
)
obj
;
intf_thread_t
*
intf
=
(
intf_thread_t
*
)
obj
->
p_private
;
QPointer
<
MainInterface
>
*
miP
=
(
QPointer
<
MainInterface
>
*
)
wnd
->
p_private
;
QMutexLocker
locker
(
&
windowLock
);
intf
->
p_sys
->
p_mi
->
releaseVideo
(
wnd
->
handle
);
if
(
!
miP
->
isNull
())
vlc_object_release
(
intf
);
(
*
miP
)
->
releaseVideo
(
wnd
->
handle
);
delete
miP
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment