Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
0ea9d324
Commit
0ea9d324
authored
Sep 03, 2015
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx dialog provider: drop legacy NSAutoreleasePool pattern
parent
aac85143
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
84 additions
and
76 deletions
+84
-76
modules/gui/macosx_dialog_provider/dialogProvider.m
modules/gui/macosx_dialog_provider/dialogProvider.m
+84
-76
No files found.
modules/gui/macosx_dialog_provider/dialogProvider.m
View file @
0ea9d324
...
...
@@ -191,119 +191,127 @@ void CloseIntf(vlc_object_t *p_this)
*****************************************************************************/
static
int
DisplayError
(
vlc_object_t
*
p_this
,
const
char
*
type
,
vlc_value_t
previous
,
vlc_value_t
value
,
void
*
data
)
{
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
dialog_fatal_t
*
dialog
=
value
.
p_address
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_sys_t
*
sys
=
p_intf
->
p_sys
;
[
sys
->
displayer
performSelectorOnMainThread
:
@selector
(
displayError
:)
withObject
:
DictFromDialogFatal
(
dialog
)
waitUntilDone
:
NO
];
[
pool
release
];
return
VLC_SUCCESS
;
@autoreleasepool
{
dialog_fatal_t
*
dialog
=
value
.
p_address
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_sys_t
*
sys
=
p_intf
->
p_sys
;
[
sys
->
displayer
performSelectorOnMainThread
:
@selector
(
displayError
:)
withObject:
DictFromDialogFatal
(
dialog
)
waitUntilDone:
NO
];
return
VLC_SUCCESS
;
}
}
static
int
DisplayCritical
(
vlc_object_t
*
p_this
,
const
char
*
type
,
vlc_value_t
previous
,
vlc_value_t
value
,
void
*
data
)
{
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
dialog_fatal_t
*
dialog
=
value
.
p_address
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_sys_t
*
sys
=
p_intf
->
p_sys
;
[
sys
->
displayer
performSelectorOnMainThread
:
@selector
(
displayCritical
:)
withObject
:
DictFromDialogFatal
(
dialog
)
waitUntilDone
:
NO
];
[
pool
release
];
return
VLC_SUCCESS
;
@autoreleasepool
{
dialog_fatal_t
*
dialog
=
value
.
p_address
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_sys_t
*
sys
=
p_intf
->
p_sys
;
[
sys
->
displayer
performSelectorOnMainThread
:
@selector
(
displayCritical
:)
withObject:
DictFromDialogFatal
(
dialog
)
waitUntilDone:
NO
];
return
VLC_SUCCESS
;
}
}
static
int
DisplayQuestion
(
vlc_object_t
*
p_this
,
const
char
*
type
,
vlc_value_t
previous
,
vlc_value_t
value
,
void
*
data
)
{
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
dialog_question_t
*
dialog
=
value
.
p_address
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_sys_t
*
sys
=
p_intf
->
p_sys
;
dialog
->
answer
=
[[
sys
->
displayer
resultFromSelectorOnMainThread
:
@selector
(
displayQuestion
:)
withObject
:
DictFromDialogQuestion
(
dialog
)]
intValue
];
[
pool
release
];
return
VLC_SUCCESS
;
@autoreleasepool
{
dialog_question_t
*
dialog
=
value
.
p_address
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_sys_t
*
sys
=
p_intf
->
p_sys
;
dialog
->
answer
=
[[
sys
->
displayer
resultFromSelectorOnMainThread
:
@selector
(
displayQuestion
:)
withObject:
DictFromDialogQuestion
(
dialog
)]
intValue
];
return
VLC_SUCCESS
;
}
}
static
int
DisplayLogin
(
vlc_object_t
*
p_this
,
const
char
*
type
,
vlc_value_t
previous
,
vlc_value_t
value
,
void
*
data
)
{
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
dialog_login_t
*
dialog
=
value
.
p_address
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_sys_t
*
sys
=
p_intf
->
p_sys
;
NSDictionary
*
dict
=
[
sys
->
displayer
resultFromSelectorOnMainThread
:
@selector
(
displayLogin
:)
withObject
:
DictFromDialogLogin
(
dialog
)];
if
(
dict
)
{
*
dialog
->
username
=
strdup
([[
dict
objectForKey
:
@"username"
]
UTF8String
]);
*
dialog
->
password
=
strdup
([[
dict
objectForKey
:
@"password"
]
UTF8String
]);
@autoreleasepool
{
dialog_login_t
*
dialog
=
value
.
p_address
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_sys_t
*
sys
=
p_intf
->
p_sys
;
NSDictionary
*
dict
=
[
sys
->
displayer
resultFromSelectorOnMainThread
:
@selector
(
displayLogin
:)
withObject:
DictFromDialogLogin
(
dialog
)];
if
(
dict
)
{
*
dialog
->
username
=
strdup
([[
dict
objectForKey
:
@"username"
]
UTF8String
]);
*
dialog
->
password
=
strdup
([[
dict
objectForKey
:
@"password"
]
UTF8String
]);
}
return
VLC_SUCCESS
;
}
[
pool
release
];
return
VLC_SUCCESS
;
}
static
int
DisplayProgressPanelAction
(
vlc_object_t
*
p_this
,
const
char
*
type
,
vlc_value_t
previous
,
vlc_value_t
value
,
void
*
data
)
{
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
dialog_progress_bar_t
*
dialog
=
value
.
p_address
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_sys_t
*
sys
=
p_intf
->
p_sys
;
[
sys
->
displayer
performSelectorOnMainThread
:
@selector
(
displayProgressBar
:)
withObject
:
DictFromDialogProgressBar
(
dialog
)
waitUntilDone
:
YES
];
dialog
->
pf_update
=
updateProgressPanel
;
dialog
->
pf_check
=
checkProgressPanel
;
dialog
->
pf_destroy
=
destroyProgressPanel
;
dialog
->
p_sys
=
p_intf
->
p_sys
;
[
pool
release
];
return
VLC_SUCCESS
;
@autoreleasepool
{
dialog_progress_bar_t
*
dialog
=
value
.
p_address
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_sys_t
*
sys
=
p_intf
->
p_sys
;
[
sys
->
displayer
performSelectorOnMainThread
:
@selector
(
displayProgressBar
:)
withObject:
DictFromDialogProgressBar
(
dialog
)
waitUntilDone:
YES
];
dialog
->
pf_update
=
updateProgressPanel
;
dialog
->
pf_check
=
checkProgressPanel
;
dialog
->
pf_destroy
=
destroyProgressPanel
;
dialog
->
p_sys
=
p_intf
->
p_sys
;
return
VLC_SUCCESS
;
}
}
static
int
DisplayExtension
(
vlc_object_t
*
p_this
,
const
char
*
type
,
vlc_value_t
previous
,
vlc_value_t
value
,
void
*
data
)
{
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_sys_t
*
sys
=
p_intf
->
p_sys
;
extension_dialog_t
*
dialog
=
value
.
p_address
;
@autoreleasepool
{
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_sys_t
*
sys
=
p_intf
->
p_sys
;
extension_dialog_t
*
dialog
=
value
.
p_address
;
// -updateExtensionDialog: Open its own runloop, so be sure to run on DefaultRunLoop.
[
sys
->
displayer
performSelectorOnMainThread
:
@selector
(
updateExtensionDialog
:)
withObject
:
[
NSValue
valueWithPointer
:
dialog
]
waitUntilDone
:
YES
];
[
pool
release
];
return
VLC_SUCCESS
;
// -updateExtensionDialog: Open its own runloop, so be sure to run on DefaultRunLoop.
[
sys
->
displayer
performSelectorOnMainThread
:
@selector
(
updateExtensionDialog
:)
withObject:
[
NSValue
valueWithPointer
:
dialog
]
waitUntilDone:
YES
];
return
VLC_SUCCESS
;
}
}
void
updateProgressPanel
(
void
*
priv
,
const
char
*
text
,
float
value
)
{
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
intf_sys_t
*
sys
=
(
intf_sys_t
*
)
priv
;
NSDictionary
*
dict
=
[
NSDictionary
dictionaryWithObjectsAndKeys
:
@
(
value
),
@"value"
,
text
?
@
(
text
)
:
nil
,
@"text"
,
nil
];
@autoreleasepool
{
intf_sys_t
*
sys
=
(
intf_sys_t
*
)
priv
;
[
sys
->
displayer
performSelectorOnMainThread
:
@selector
(
updateProgressPanel
:)
withObject
:
dict
waitUntilDone
:
YES
];
NSDictionary
*
dict
=
[
NSDictionary
dictionaryWithObjectsAndKeys
:
@
(
value
),
@"value"
,
text
?
@
(
text
)
:
nil
,
@"text"
,
nil
];
[
pool
release
];
[
sys
->
displayer
performSelectorOnMainThread
:
@selector
(
updateProgressPanel
:)
withObject:
dict
waitUntilDone:
YES
];
}
}
void
destroyProgressPanel
(
void
*
priv
)
{
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
intf_sys_t
*
sys
=
(
intf_sys_t
*
)
priv
;
[
sys
->
displayer
performSelectorOnMainThread
:
@selector
(
destroyProgressPanel
)
withObject
:
nil
waitUntilDone
:
YES
];
[
pool
release
];
@autoreleasepool
{
intf_sys_t
*
sys
=
(
intf_sys_t
*
)
priv
;
[
sys
->
displayer
performSelectorOnMainThread
:
@selector
(
destroyProgressPanel
)
withObject:
nil
waitUntilDone:
YES
];
}
}
bool
checkProgressPanel
(
void
*
priv
)
{
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
intf_sys_t
*
sys
=
(
intf_sys_t
*
)
priv
;
BOOL
ret
;
ret
=
[[
sys
->
displayer
resultFromSelectorOnMainThread
:
@selector
(
checkProgressPanel
)
withObject
:
nil
]
boolValue
];
[
pool
release
];
return
ret
;
@autoreleasepool
{
intf_sys_t
*
sys
=
(
intf_sys_t
*
)
priv
;
return
[[
sys
->
displayer
resultFromSelectorOnMainThread
:
@selector
(
checkProgressPanel
)
withObject:
nil
]
boolValue
];
}
}
@interface
VLCDialogDisplayer
()
<
NSWindowDelegate
>
...
...
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