0001064: Crash occurs in version 0.13 when trying to use alignment tool

This commit is contained in:
wmayer 2013-03-30 14:46:51 +01:00
parent c70a39c961
commit 7c3e6fa50f
4 changed files with 11 additions and 13 deletions

View File

@ -335,7 +335,9 @@ public:
QSplitter* mainSplitter=0;
mainSplitter = new QSplitter(Qt::Horizontal, this);
_viewer.push_back(new View3DInventorViewer(mainSplitter));
_viewer.back()->setDocument(pcDocument);
_viewer.push_back(new View3DInventorViewer(mainSplitter));
_viewer.back()->setDocument(pcDocument);
QFrame* vbox = new QFrame(this);
QVBoxLayout* layout = new QVBoxLayout();

View File

@ -60,9 +60,6 @@
#include <Inventor/events/SoLocation2Event.h>
#include <Inventor/SoPickedPoint.h>
#include "View3DInventor.h"
#include "View3DInventorViewer.h"
#include <Base/Console.h>
#include <App/Application.h>
#include <App/Document.h>
@ -90,7 +87,7 @@ SO_NODE_SOURCE(SoFCUnifiedSelection);
/*!
Constructor.
*/
SoFCUnifiedSelection::SoFCUnifiedSelection() : viewer(0)
SoFCUnifiedSelection::SoFCUnifiedSelection() : pcDocument(0)
{
SO_NODE_CONSTRUCTOR(SoFCUnifiedSelection);
@ -289,8 +286,9 @@ void SoFCUnifiedSelection::doAction(SoAction *action)
}
else if (selaction->SelChange.Type == SelectionChanges::ClrSelection ||
selaction->SelChange.Type == SelectionChanges::SetSelection) {
std::vector<ViewProvider*> vps = this->pcDocument->getViewProvidersOfType
(ViewProviderDocumentObject::getClassTypeId());
std::vector<ViewProvider*> vps;
if (this->pcDocument)
vps = this->pcDocument->getViewProvidersOfType(ViewProviderDocumentObject::getClassTypeId());
for (std::vector<ViewProvider*>::iterator it = vps.begin(); it != vps.end(); ++it) {
ViewProviderDocumentObject* vpd = static_cast<ViewProviderDocumentObject*>(*it);
if (vpd->useNewSelectionModel()) {
@ -350,8 +348,8 @@ SoFCUnifiedSelection::handleEvent(SoHandleEventAction * action)
SoFullPath *pPath = (pp != NULL) ? (SoFullPath *) pp->getPath() : NULL;
ViewProvider *vp = 0;
ViewProviderDocumentObject* vpd = 0;
if (pPath && pPath->containsPath(action->getCurPath()))
vp = pcDocument->getViewProviderByPathFromTail(pPath);
if (this->pcDocument && pPath && pPath->containsPath(action->getCurPath()))
vp = this->pcDocument->getViewProviderByPathFromTail(pPath);
if (vp && vp->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId()))
vpd = static_cast<ViewProviderDocumentObject*>(vp);
@ -423,8 +421,8 @@ SoFCUnifiedSelection::handleEvent(SoHandleEventAction * action)
SoFullPath *pPath = (pp != NULL) ? (SoFullPath *) pp->getPath() : NULL;
ViewProvider *vp = 0;
ViewProviderDocumentObject* vpd = 0;
if (pPath && pPath->containsPath(action->getCurPath()))
vp = pcDocument->getViewProviderByPathFromTail(pPath);
if (this->pcDocument && pPath && pPath->containsPath(action->getCurPath()))
vp = this->pcDocument->getViewProviderByPathFromTail(pPath);
if (vp && vp->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId()))
vpd = static_cast<ViewProviderDocumentObject*>(vp);
if (vpd && vpd->useNewSelectionModel() && vpd->isSelectable()) {

View File

@ -95,8 +95,6 @@ protected:
//virtual void redrawHighlighted(SoAction * act, SbBool flag);
//virtual SbBool readInstance(SoInput * in, unsigned short flags);
View3DInventorViewer *viewer;
Gui::Document *pcDocument;
private:
//static void turnoffcurrent(SoAction * action);
//void setOverride(SoGLRenderAction * action);
@ -104,6 +102,7 @@ private:
//SbBool preRender(SoGLRenderAction *act, GLint &oldDepthFunc);
static int getPriority(const SoPickedPoint* p);
const SoPickedPoint* getPickedPoint(SoHandleEventAction*) const;
Gui::Document *pcDocument;
static SoFullPath * currenthighlight;

View File

@ -217,7 +217,6 @@ View3DInventorViewer::View3DInventorViewer (QWidget *parent, const char *name,
// must be created. Using an SoSeparator avoids this drawback.
selectionRoot = new Gui::SoFCUnifiedSelection();
selectionRoot->applySettings();
selectionRoot->viewer = this;
#endif
// set the ViewProvider root node
pcViewProviderRoot = selectionRoot;