After two days, I finally solve this.
I pay attention to the constructor of pcl::visualization::PCLVisualizer and also "SpinOnce" function and I recognize that if you put a static lock, so that just one thread among multiple objects can access these functions, then the problem will be solved.
previously, I put non static locks on these function, and as you know local locks just work in the same object which they are created in (Not the whole objects which are instantiated from a class). So I defined a static lock in my_vis class:
private static boost::mutex vis_mutex;
boost::mutex my_vis::vis_mutex; //storage for static lock
and replace "vis->spinOnce(1)" with
{
boost::mutex::scoped_lock vis_lock(vis_mutex);
vis->spinOnce ();
}
I still think that it is not a permanent solution, and this bug is better to be solved by pcl developers :)