vtk+ qt + realsense sdk ?

Hello peeps, I have set up a minimum working Qt+Vtk application and I have been trying to stream a realsense image stream in a QVtkWindow like this, where i have set up the realsense stream loop in a separate QThread :

rs2::frameset data = pipe.wait_for_frames();
rs2::video_frame depth = data.get_depth_frame().apply_filter(color_map);
rs2::depth_frame depth_temp = data.get_depth_frame();

auto width = depth.get_width();
auto height = depth.get_height();

vtkSmartPointer imageData = vtkSmartPointer::New();
imageData->SetDimensions(depth.get_width(), depth.get_height(), 1);
imageData->AllocateScalars(VTK_UNSIGNED_CHAR, 3);
void* imageDataPtr = static_cast<void *>(imageData->GetScalarPointer());
std::memcpy(imageDataPtr, depth.get_data(), depth.get_data_size());

emit newFrameReady(imageData);

after a new frame is received, im using a signal slot connection in qt to update the vtk window. But the image stream is deferred and eventually the application crashes. I want to know if you peeps can think of any possible cause or if there is a better way of doing this whole thing ?

I suspect that the queued signal only holds a reference to imageData. When the emitting function ends, it destroys the only imageData reference count. Other threads then access that reference-that-was-imageData and get garbage.