Use a weak reference to the parent instead of a pointer to avoid crashing if the parent TLW is destroyed before wxGenericProgressDialog itself is. This is unlikely to happen in C++ code, where objects of this class are typically created on the stack, but can happen in e.g. wxPython where this is not the case. Closes #16378.