[Slim-Checkins] r11077 - in /trunk/server/Slim: Buttons/Common.pm
Display/Display.pm
adrian at svn.slimdevices.com
adrian at svn.slimdevices.com
Mon Jan 1 17:52:56 PST 2007
Author: adrian
Date: Mon Jan 1 17:52:56 2007
New Revision: 11077
URL: http://svn.slimdevices.com?rev=11077&view=rev
Log:
Bug: N/A
Description: wrap calls to lines and remaining setMode/exitMode in eval
Modified:
trunk/server/Slim/Buttons/Common.pm
trunk/server/Slim/Display/Display.pm
Modified: trunk/server/Slim/Buttons/Common.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Buttons/Common.pm?rev=11077&r1=11076&r2=11077&view=diff
==============================================================================
--- trunk/server/Slim/Buttons/Common.pm (original)
+++ trunk/server/Slim/Buttons/Common.pm Mon Jan 1 17:52:56 2007
@@ -1563,7 +1563,12 @@
my $exitFun = $leaveMode{$oldmode};
if ($exitFun && ref($exitFun) eq 'CODE') {
- &$exitFun($client, 'push');
+
+ eval { &$exitFun($client, 'push') };
+
+ if ($@) {
+ logError("Couldn't execute mode exit function: $@");
+ }
}
}
@@ -1643,7 +1648,12 @@
my $exitFun = $leaveMode{$oldMode};
if ($exitFun && ref($exitFun) eq 'CODE') {
- &$exitFun($client, 'pop');
+
+ eval { &$exitFun($client, 'pop') };
+
+ if ($@) {
+ logError("Couldn't execute mode exit function: $@");
+ }
}
}
@@ -1659,7 +1669,11 @@
my $fun = $modes{$newMode};
- &$fun($client,'pop');
+ eval { &$fun($client,'pop') };
+
+ if ($@) {
+ logError("Couldn't execute setMode on pop: $@");
+ }
}
$log->info("Popped to button mode: " . (mode($client) || 'empty!'));
@@ -1890,7 +1904,14 @@
}
if ($update2 && (!$display->updateMode || $display->screen2updateOK) && (my $linefunc = $client->lines2periodic()) ) {
- $client->display->update({ 'screen2' => &$linefunc($client, 1) }, undef, 1);
+
+ my $screen2 = eval { &$linefunc($client, 1) };
+
+ if ($@) {
+ logError("bad screen2 lines: $@");
+ }
+
+ $client->display->update({ 'screen2' => $screen2 }, undef, 1);
}
}
Modified: trunk/server/Slim/Display/Display.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Display/Display.pm?rev=11077&r1=11076&r2=11077&view=diff
==============================================================================
--- trunk/server/Slim/Display/Display.pm (original)
+++ trunk/server/Slim/Display/Display.pm Mon Jan 1 17:52:56 2007
@@ -169,9 +169,14 @@
if (defined($lines)) {
$parts = $display->parseLines($lines);
+
} else {
$linefunc = $client->lines();
- $parts = $display->parseLines(&$linefunc($client));
+ $parts = eval { $display->parseLines(&$linefunc($client)) };
+
+ if ($@) {
+ logError("bad lines function: $@");
+ }
}
if ($log->is_info) {
@@ -445,29 +450,28 @@
sub curLines {
my $display = shift;
-
my $client;
+ my $parts;
if ($display->isa('Slim::Display::Display')) {
$client = $display->client;
- } elsif ($display->isa('Slim::Player::Player')) {
-
- # this code is reached if curLines is called with the old API rather than a method of display
+ my $linefunc = $client->lines();
+
+ if (defined $linefunc) {
+ $parts = eval { $display->parseLines(&$linefunc($client)) };
+
+ if ($@) {
+ logError("bad lines function: $@");
+ }
+ }
+
+ } else {
+ # not called as a display method - depreciated
logBacktrace("This function is depreciated, please call \$client->curLines()");
- $client = $display;
-
- } else {
- return undef;
- }
-
- my $linefunc = $client->lines();
-
- if (defined $linefunc) {
- return $display->parseLines(&$linefunc($client));
- } else {
- return undef;
- }
+ }
+
+ return $parts;
}
# Parse lines into the latest hash format. Provides backward compatibility for array and escaped lines definitions
More information about the checkins
mailing list