[LON-CAPA-cvs] cvs: loncom /homework grades.pm /interface loncoursedata.pm lonhelper.pm lonnavmaps.pm lonquickgrades.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Thu, 07 Oct 2004 22:12:48 -0000
albertel Thu Oct 7 18:12:48 2004 EDT
Modified files:
/loncom/interface loncoursedata.pm lonhelper.pm lonquickgrades.pm
lonnavmaps.pm
/loncom/homework grades.pm
Log:
- fixes bug#3350 hopefully for good.
- $navmaps objects never actaully got cleaned up due the resource objects in it holding a reference back to the navmap object, this meant the hashes didn't get untied and that we leaked memory
- needs WeakRef
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.139 loncom/interface/loncoursedata.pm:1.140
--- loncom/interface/loncoursedata.pm:1.139 Thu Sep 23 10:46:03 2004
+++ loncom/interface/loncoursedata.pm Thu Oct 7 18:12:47 2004
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: loncoursedata.pm,v 1.139 2004/09/23 14:46:03 matthew Exp $
+# $Id: loncoursedata.pm,v 1.140 2004/10/07 22:12:47 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -208,7 +208,6 @@
$currentmap->{'num_assess'}++;
$currentmap->{'num_assess_parts'}+= scalar(@$parts);
}
- $navmap->untieHashes();
return ($top,\@Sequences,\@Assessments);
}
Index: loncom/interface/lonhelper.pm
diff -u loncom/interface/lonhelper.pm:1.87 loncom/interface/lonhelper.pm:1.88
--- loncom/interface/lonhelper.pm:1.87 Fri Sep 24 15:49:12 2004
+++ loncom/interface/lonhelper.pm Thu Oct 7 18:12:47 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# .helper XML handler to implement the LON-CAPA helper
#
-# $Id: lonhelper.pm,v 1.87 2004/09/24 19:49:12 matthew Exp $
+# $Id: lonhelper.pm,v 1.88 2004/10/07 22:12:47 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3147,7 +3147,6 @@
my $res = $navmap->getByMapPc($vars->{RESOURCE_ID});
my $title = $res->compTitle();
$symb = $res->symb();
- $navmap->untieHashes();
$resourceString .= '<li>'.&mt('for the map named [_1]',"<b>$title</b>").'</li>';
$level = 8;
$affectedResourceId = $vars->{RESOURCE_ID};
@@ -3157,7 +3156,6 @@
my $res = $navmap->getById($vars->{RESOURCE_ID});
$symb = $res->symb();
my $title = $res->compTitle();
- $navmap->untieHashes();
$resourceString .= '<li>'.&mt('for the resource named [_1]',"<b>$title</b>").'</li>';
$level = 7;
$affectedResourceId = $vars->{RESOURCE_ID};
Index: loncom/interface/lonquickgrades.pm
diff -u loncom/interface/lonquickgrades.pm:1.31 loncom/interface/lonquickgrades.pm:1.32
--- loncom/interface/lonquickgrades.pm:1.31 Thu Jul 15 15:20:41 2004
+++ loncom/interface/lonquickgrades.pm Thu Oct 7 18:12:47 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Quick Student Grades Display
#
-# $Id: lonquickgrades.pm,v 1.31 2004/07/15 19:20:41 albertel Exp $
+# $Id: lonquickgrades.pm,v 1.32 2004/10/07 22:12:47 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -286,8 +286,6 @@
$r->print("</table></body></html>");
- $navmap->untieHashes();
-
return OK;
}
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.299 loncom/interface/lonnavmaps.pm:1.300
--- loncom/interface/lonnavmaps.pm:1.299 Mon Oct 4 17:35:52 2004
+++ loncom/interface/lonnavmaps.pm Thu Oct 7 18:12:47 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.299 2004/10/04 21:35:52 raeburn Exp $
+# $Id: lonnavmaps.pm,v 1.300 2004/10/07 22:12:47 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -35,7 +35,7 @@
use Apache::lonmenu();
use Apache::lonlocal;
use POSIX qw (floor strftime);
-use Data::Dumper; # for debugging, not always used
+use Data::Dumper; # for debugging, not always
# symbolic constants
sub SYMB { return 1; }
@@ -410,7 +410,6 @@
'caller' => 'navmapsdisplay',
'linkitems' => \%toplinkitems};
my $render = render($renderArgs);
- $navmap->untieHashes();
# If no resources were printed, print a reassuring message so the
# user knows there was no error.
@@ -1940,8 +1939,6 @@
$r->rflush();
}
- if ($mustCloseNavMap) { $navmap->untieHashes(); }
-
return $result;
}
@@ -2042,10 +2039,6 @@
=back
-When you are done with the $navmap object, you I<must> call
-$navmap->untieHashes(), or you'll prevent the current user from using that
-course until the web server is restarted. (!)
-
=head2 Methods
=over 4
@@ -2262,13 +2255,6 @@
return $iterator;
}
-# unties the hash when done
-sub untieHashes {
- my $self = shift;
- untie %{$self->{NAV_HASH}};
- untie %{$self->{PARM_HASH}};
-}
-
# Private method: Does the given resource (as a symb string) have
# current discussion? Returns 0 if chat/mail data not extracted.
sub hasDiscussion {
@@ -2649,7 +2635,7 @@
1;
package Apache::lonnavmaps::iterator;
-
+use WeakRef;
=pod
=back
@@ -2789,7 +2775,7 @@
my $class = ref($proto) || $proto;
my $self = {};
- $self->{NAV_MAP} = shift;
+ weaken($self->{NAV_MAP} = shift);
return undef unless ($self->{NAV_MAP});
# Handle the parameters
@@ -3125,7 +3111,7 @@
1;
package Apache::lonnavmaps::DFSiterator;
-
+use WeakRef;
# Not documented in the perldoc: This is a simple iterator that just walks
# through the nav map and presents the resources in a depth-first search
# fashion, ignorant of conditionals, randomized resources, etc. It presents
@@ -3153,7 +3139,7 @@
my $class = ref($proto) || $proto;
my $self = {};
- $self->{NAV_MAP} = shift;
+ weaken($self->{NAV_MAP} = shift);
return undef unless ($self->{NAV_MAP});
$self->{FIRST_RESOURCE} = shift || $self->{NAV_MAP}->firstResource();
@@ -3307,7 +3293,7 @@
1;
package Apache::lonnavmaps::resource;
-
+use WeakRef;
use Apache::lonnet;
=pod
@@ -3389,7 +3375,7 @@
my $class = ref($proto) || $proto;
my $self = {};
- $self->{NAV_MAP} = shift;
+ weaken($self->{NAV_MAP} = shift);
$self->{ID} = shift;
# Store this new resource in the parent nav map's cache.
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.219 loncom/homework/grades.pm:1.220
--- loncom/homework/grades.pm:1.219 Wed Sep 29 11:04:50 2004
+++ loncom/homework/grades.pm Thu Oct 7 18:12:47 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.219 2004/09/29 15:04:50 www Exp $
+# $Id: grades.pm,v 1.220 2004/10/07 22:12:47 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3070,8 +3070,6 @@
$minder++;
}
}
-
- $navmap->untieHashes();
return \@titles,\%symbx;
}
@@ -3204,8 +3202,6 @@
$curRes = $iterator->next();
}
- $navmap->untieHashes();
-
$studentTable.='</td></tr></table></td></tr></table>'."\n".
'<input type="button" value="Save" '.
'onClick="javascript:checkSubmitPage(this.form,'.$question.');" TARGET=_self />'.
@@ -3401,8 +3397,6 @@
$curRes = $iterator->next();
}
- $navmap->untieHashes();
-
$studentTable.='</td></tr></table></td></tr></table>';
$studentTable.=&show_grading_menu_form($ENV{'form.symb'},$ENV{'form.url'});
my $grademsg=($changeflag == 0 ? 'No score was changed or updated.' :
@@ -4652,7 +4646,6 @@
# my $lasttime = &Time::HiRes::time()-$start;
# $r->print("<p>took $lasttime</p>");
- $navmap->untieHashes();
$r->print("</form>");
$r->print(&show_grading_menu_form($symb,$url));
return '';