Commit 41b8e258 authored by Oliver Kellogg's avatar Oliver Kellogg

https://bugs.kde.org/show_bug.cgi?id=347498#c8

> I experienced the following crash on exiting Umbrello:
> Application: Umbrello...  (umbrello5), signal: Segmentation fault
> [...]
> AFAICT the critical place is umlobject.cpp ... setUMLStereotype,
>    emitModified();
> We should not emit the signal during destruction.

umbrello/uml.{h,cpp}
- Add public static function shuttingDown() returning bool.
- Add private static variable s_shuttingDown with documentation on why
  this variable is static.
- In UMLApp destructor set s_shuttingDown to true.

- In function setUMLStereotype(UMLStereotype) conditionalize call to
  emitModified() on UMLApp::shuttingDown() returning false.

CCBUG:347498
parent af167857
......@@ -130,6 +130,14 @@
/** Static pointer, holding the last created instance. */
UMLApp* UMLApp::s_instance;
/**
* Static flag returned by static function shuttingDown().
* It is intentionally an extra static member because it is queried
* after calling the UMLApp destructor.
* Member accesses shall be avoided during destruction.
*/
bool UMLApp::s_shuttingDown = false;
/**
* Searches for a menu with the given name.
* @todo This is an ugly _HACK_ to allow to compile umbrello.
......@@ -235,6 +243,7 @@ UMLApp::UMLApp(QWidget* parent)
*/
UMLApp::~UMLApp()
{
s_shuttingDown = true;
disconnect(m_pZoomInPB, SIGNAL(clicked()), this, SLOT(slotZoomIn()));
disconnect(m_pZoomSlider, SIGNAL(valueChanged(int)), this, SLOT(slotZoomSliderMoved(int)));
#if QT_VERSION >= 0x050000
......@@ -2925,6 +2934,14 @@ void UMLApp::updateLangSelectMenu(Uml::ProgrammingLanguage::Enum activeLanguage)
}
}
/**
* Return true during shutdown, i.e. during ~UMLApp().
*/
bool UMLApp::shuttingDown()
{
return s_shuttingDown;
}
/**
* Event handler to receive key press events.
*/
......
......@@ -197,6 +197,8 @@ public:
KConfig* config();
void importFiles(QStringList& fileList, const QString &rootPath = QString());
static bool shuttingDown();
protected:
virtual void keyPressEvent(QKeyEvent* e);
virtual void keyReleaseEvent(QKeyEvent* e);
......@@ -517,6 +519,7 @@ private:
QPointer<DiagramPrintPage> m_printSettings; ///< printer diagram settings
QPrinter *m_printer; ///< print instance
static bool s_shuttingDown;
signals:
void sigCutSuccessful();
......
......@@ -515,7 +515,8 @@ void UMLObject::setUMLStereotype(UMLStereotype *stereo)
}
m_pStereotype = stereo;
// TODO: don't emit modified() if predefined folder
emitModified();
if (!UMLApp::shuttingDown())
emitModified();
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment