using new WP_Query in save_post function alters $post

Since wp_reset_query() and wp_reset_post() didn’t appear to do anything in this situation, here’s something that seems to work. I’m not entirely sure if this is the accepted approach, but I got it working by temporarily storing the $post value before the WP_Query, then setting it back to the $post variable after the query was complete.

$currentpost = $post;

$query = new WP_Query(/* ... */);

while($query->have_posts()){
     $query->the_post();
     //do stuff
}

$post = $currentpost;