Commit f0b52a9e authored by Tor Didriksen's avatar Tor Didriksen

Backport Bug#13724099

parent 8a048ecb
#ifndef INCLUDES_MYSQL_SQL_LIST_H #ifndef INCLUDES_MYSQL_SQL_LIST_H
#define INCLUDES_MYSQL_SQL_LIST_H #define INCLUDES_MYSQL_SQL_LIST_H
/* /* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -165,6 +164,14 @@ protected: ...@@ -165,6 +164,14 @@ protected:
public: public:
uint elements; 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 void empty() { elements=0; first= &end_of_list; last=&first;}
inline base_list() { empty(); } 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 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 it under the terms of the GNU General Public License as published by
...@@ -1676,6 +1676,8 @@ JOIN::optimize() ...@@ -1676,6 +1676,8 @@ JOIN::optimize()
*/ */
void JOIN::restore_tmp() 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)); memcpy(tmp_join, this, (size_t) sizeof(JOIN));
} }
...@@ -7090,13 +7092,18 @@ void JOIN::cleanup(bool full) ...@@ -7090,13 +7092,18 @@ void JOIN::cleanup(bool full)
{ {
if (tmp_join) if (tmp_join)
tmp_table_param.copy_field= 0; 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. twice for the same list.
*/ */
if (tmp_join && tmp_join != this) if (tmp_join && tmp_join != this &&
tmp_join->group_fields= group_fields; 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 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. 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