Commit 30d1728b authored by Tor Didriksen's avatar Tor Didriksen

Backport Bug#13724099

parent f876fac1
#ifndef INCLUDES_MYSQL_SQL_LIST_H
#define INCLUDES_MYSQL_SQL_LIST_H
/*
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -165,6 +164,14 @@ class base_list :public Sql_alloc
public:
uint elements;
bool operator==(const base_list &rhs) const
{
return
elements == rhs.elements &&
first == rhs.first &&
last == rhs.last;
}
inline void empty() { elements=0; first= &end_of_list; last=&first;}
inline base_list() { empty(); }
/**
......
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -1676,6 +1676,8 @@ JOIN::optimize()
*/
void JOIN::restore_tmp()
{
DBUG_PRINT("info", ("restore_tmp this %p tmp_join %p", this, tmp_join));
DBUG_ASSERT(tmp_join != this);
memcpy(tmp_join, this, (size_t) sizeof(JOIN));
}
......@@ -7090,13 +7092,18 @@ void JOIN::cleanup(bool full)
{
if (tmp_join)
tmp_table_param.copy_field= 0;
group_fields.delete_elements();
/*
Ensure that the above delete_elements() would not be called
Ensure that the following delete_elements() would not be called
twice for the same list.
*/
if (tmp_join && tmp_join != this)
tmp_join->group_fields= group_fields;
if (tmp_join && tmp_join != this &&
tmp_join->group_fields == this->group_fields)
tmp_join->group_fields.empty();
// Run Cached_item DTORs!
group_fields.delete_elements();
/*
We can't call delete_elements() on copy_funcs as this will cause
problems in free_elements() as some of the elements are then deleted.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment