ViewProvider: fix potential crash when exit editing
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <QApplication>
|
||||
# include <QPixmap>
|
||||
# include <QTimer>
|
||||
# include <Inventor/SoPickedPoint.h>
|
||||
@@ -56,6 +57,8 @@
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
FC_LOG_LEVEL_INIT("ViewProvider",true,true)
|
||||
|
||||
using namespace std;
|
||||
using namespace Gui;
|
||||
|
||||
@@ -178,13 +181,22 @@ void ViewProvider::eventCallback(void * ud, SoEventCallback * node)
|
||||
if (self->keyPressed (press, ke->getKey())) {
|
||||
node->setHandled();
|
||||
}
|
||||
else {
|
||||
else if(QApplication::mouseButtons()==Qt::NoButton) {
|
||||
// Because of a Coin bug (https://bitbucket.org/Coin3D/coin/pull-requests/119),
|
||||
// FC may crash if user hits ESC to cancel while still
|
||||
// holding the mouse button while using some SoDragger.
|
||||
// Therefore, we shall ignore ESC while any mouse button is
|
||||
// pressed, until this Coin bug is fixed.
|
||||
|
||||
Gui::TimerFunction* func = new Gui::TimerFunction();
|
||||
func->setAutoDelete(true);
|
||||
Gui::Document* doc = Gui::Application::Instance->activeDocument();
|
||||
func->setFunction(boost::bind(&Document::resetEdit, doc));
|
||||
QTimer::singleShot(0, func, SLOT(timeout()));
|
||||
}
|
||||
else if (press) {
|
||||
FC_WARN("Please release all mouse buttons before exiting editing");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// call the virtual method
|
||||
|
||||
Reference in New Issue
Block a user