[vlc-devel] commit: macosx_dialog_provider: Fix a few ignored selector, and assert on bad selector. (Pierre d'Herbemont )
git version control
git at videolan.org
Mon Jan 4 02:43:08 CET 2010
vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Sun Jan 3 21:52:07 2010 +0100| [bdaad35723b8d43690baff598d3b6d2664b7cc6c] | committer: Pierre d'Herbemont
macosx_dialog_provider: Fix a few ignored selector, and assert on bad selector.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bdaad35723b8d43690baff598d3b6d2664b7cc6c
---
.../gui/macosx_dialog_provider/dialogProvider.m | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/modules/gui/macosx_dialog_provider/dialogProvider.m b/modules/gui/macosx_dialog_provider/dialogProvider.m
index 128f861..7a8670f 100644
--- a/modules/gui/macosx_dialog_provider/dialogProvider.m
+++ b/modules/gui/macosx_dialog_provider/dialogProvider.m
@@ -235,7 +235,7 @@ static int DisplayLogin(vlc_object_t *p_this, const char *type, vlc_value_t prev
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(displayCritical:) withObject:DictFromDialogLogin(dialog)];
+ 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]);
@@ -251,7 +251,7 @@ static int DisplayProgressPanelAction(vlc_object_t *p_this, const char *type, vl
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];
+ [sys->displayer performSelectorOnMainThread:@selector(displayProgressBar:) withObject:DictFromDialogProgressBar(dialog) waitUntilDone:YES];
dialog->pf_update = updateProgressPanel;
dialog->pf_check = checkProgressPanel;
@@ -272,7 +272,7 @@ void updateProgressPanel (void *priv, const char *text, float value)
text ? [NSString stringWithUTF8String:text] : nil, @"text",
nil];
- [sys->displayer performSelectorOnMainThread:@selector(updateProgressPanel) withObject:dict waitUntilDone:YES];
+ [sys->displayer performSelectorOnMainThread:@selector(updateProgressPanel:) withObject:dict waitUntilDone:YES];
[pool release];
}
@@ -409,7 +409,7 @@ bool checkProgressPanel (void *priv)
_currentProgressBarPanel = [[VLCProgressPanel alloc] init];
[_currentProgressBarPanel createContentView];
[_currentProgressBarPanel setDialogTitle:[dialog objectForKey:@"title"]];
- [_currentProgressBarPanel setDialogMessage:[dialog objectForKey:@"message"]];
+ [_currentProgressBarPanel setDialogMessage:[dialog objectForKey:@"message"] ?: @""];
[_currentProgressBarPanel setCancelButtonLabel:[dialog objectForKey:@"cancel"]];
[_currentProgressBarPanel center];
@@ -448,8 +448,12 @@ bool checkProgressPanel (void *priv)
- (void)execute:(NSDictionary *)dict
{
SEL sel = [[dict objectForKey:@"sel"] pointerValue];
- id * result = [[dict objectForKey:@"result"] pointerValue];
+ id *result = [[dict objectForKey:@"result"] pointerValue];
id object = [dict objectForKey:@"object"];
+
+ NSAssert(sel, @"Try to execute a NULL selector");
+ NSAssert(object, @"Try to execute from a nil object");
+
*result = [self performSelector:sel withObject:object];
[*result retain]; // Balanced in -resultFromSelectorOnMainThread
}
@@ -457,11 +461,13 @@ bool checkProgressPanel (void *priv)
- (id)resultFromSelectorOnMainThread:(SEL)sel withObject:(id)object
{
id result = nil;
- [NSDictionary dictionaryWithObjectsAndKeys:
+ NSAssert(sel, @"Try to execute a NULL selector");
+ NSAssert(sel, @"Try to execute from a nil object");
+ NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSValue valueWithPointer:sel], @"sel",
[NSValue valueWithPointer:&result], @"result",
object, @"object", nil];
- [self performSelectorOnMainThread:@selector(execute:) withObject:object waitUntilDone:YES];
+ [self performSelectorOnMainThread:@selector(execute:) withObject:dict waitUntilDone:YES];
return [result autorelease];
}
@end
More information about the vlc-devel
mailing list