Fix crash when removing a tab in diffusion workspace.

Deal with validity of the pointer by using a QPointer.