Skip to content

Fix memory leaks. #2703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Mojolicious/WeBWorK.pm
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ sub startup ($app) {

$app->hook(
after_dispatch => sub ($c) {
$SIG{__WARN__} = $c->stash->{orig_sig_warn} if defined $c->stash->{orig_sig_warn};
$SIG{__WARN__} = ref($c->stash->{orig_sig_warn}) eq 'CODE' ? $c->stash->{orig_sig_warn} : 'DEFAULT';

if ($c->isa('WeBWorK::ContentGenerator') && $c->ce) {
$c->authen->store_session if $c->authen;
Expand Down
23 changes: 0 additions & 23 deletions lib/WeBWorK/Authen/LTIAdvanced.pm
Original file line number Diff line number Diff line change
Expand Up @@ -40,29 +40,6 @@ use WeBWorK::Authen::LTIAdvanced::Nonce;

$Net::OAuth::PROTOCOL_VERSION = Net::OAuth::PROTOCOL_VERSION_1_0A;

=head1 CONSTRUCTOR

=over

=item new($c)

Instantiates a new WeBWorK::Authen object for the given WeBWorK::Controller ($c).

=cut

sub new {
my ($invocant, $c) = @_;
my $class = ref($invocant) || $invocant;
my $self = { c => $c, };
#initialize
bless $self, $class;
return $self;
}

=back

=cut

## this is only overridden for debug logging
#sub verify {
# debug("BEGIN LTIAdvanced VERIFY");
Expand Down
16 changes: 0 additions & 16 deletions lib/WeBWorK/Authen/LTIAdvantage.pm
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,6 @@ use WeBWorK::Utils::DateTime qw(formatDateTime);
use WeBWorK::Utils::Instructor qw(assignSetToUser);
use WeBWorK::Authen::LTIAdvantage::SubmitGrade;

=head1 CONSTRUCTOR

=over

=item new($c)

Instantiates a new WeBWorK::Authen object for the given WeBWorK::Controller ($c).

=back

=cut

sub new ($invocant, $c) {
return bless { c => $c }, ref($invocant) || $invocant;
}

sub request_has_data_for_this_verification_module ($self) {
debug('LTIAdvantage has been called for data verification');
my $c = $self->{c};
Expand Down
2 changes: 1 addition & 1 deletion lib/WeBWorK/Authz.pm
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ sub new {
my ($invocant, $c) = @_;
my $class = ref($invocant) || $invocant;
my $self = { c => $c, };
#weaken $self->{c};
weaken $self->{c};

$c->{permission_retrieval_error} = 0;
bless $self, $class;
Expand Down
1 change: 0 additions & 1 deletion lib/WeBWorK/ContentGenerator/Home.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ WeBWorK::ContentGenerator::Home - display a list of courses.
=cut

use WeBWorK::Utils::Files qw(readFile);
use WeBWorK::Localize;

sub info ($c) {
my $result;
Expand Down
4 changes: 4 additions & 0 deletions lib/WeBWorK/DB/Schema.pm
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ dependent. C<$db> is provided so that schemas can query other schemas.

=cut

use Scalar::Util qw(weaken);

sub new {
my ($proto, $db, $driver, $table, $record, $params, $engine, $character_set) = @_;
my $class = ref($proto) || $proto;
Expand All @@ -103,6 +105,8 @@ sub new {
character_set => $character_set,
};
bless $self, $class;
weaken $self->{db};

return $self;
}

Expand Down
3 changes: 3 additions & 0 deletions lib/WeBWorK/DB/Schema/NewSQL/Merge.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ use warnings;
use Carp qw(croak);
use Iterator;
use Iterator::Util;
use Scalar::Util qw(weaken);

use WeBWorK::DB::Utils::SQLAbstractIdentTrans;
use WeBWorK::Debug;

Expand Down Expand Up @@ -121,6 +123,7 @@ sub merge_init {

sub sql_init {
my $self = shift;
weaken $self;

# Transformation function for table names. This allows us to pass the WeBWorK table names to
# SQL::Abstract, and have it translate them to the SQL table names from tableOverride.
Expand Down
3 changes: 3 additions & 0 deletions lib/WeBWorK/DB/Schema/NewSQL/Std.pm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ use Iterator;
use Iterator::Util;
use File::Temp;
use String::ShellQuote;
use Scalar::Util qw(weaken);

use WeBWorK::DB::Utils::SQLAbstractIdentTrans;
use WeBWorK::Debug;

Expand Down Expand Up @@ -64,6 +66,7 @@ sub new {

sub sql_init {
my $self = shift;
weaken $self;

# Transformation function for table names. This allows us to pass the WeBWorK table names to
# SQL::Abstract, and have it translate them to the SQL table names from tableOverride.
Expand Down