r19968 by jghali - fix crash on close due to new shape plugin : because of memory protection, on Windows it is a requirement that memory allocated by a module be freed by same module

scribus-commit scribus-commit at lists.scribus.net
Sat Apr 4 12:50:30 UTC 2015


Author: jghali
Date: Sat Apr  4 12:50:29 2015
New Revision: 19968

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19968
Log:
fix crash on close due to new shape plugin : because of memory protection, on Windows it is a requirement that memory allocated by a module be freed by same module

Modified:
    trunk/Scribus/scribus/plugins/shapes/shapeplugin.cpp
    trunk/Scribus/scribus/plugins/shapes/shapeplugin.h

Modified: trunk/Scribus/scribus/plugins/shapes/shapeplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19968&path=/trunk/Scribus/scribus/plugins/shapes/shapeplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/shapes/shapeplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/shapes/shapeplugin.cpp Sat Apr  4 12:50:29 2015
@@ -70,13 +70,13 @@
 	{
 		sc_palette->setMainWindow(mw);
 		languageChange();
-		mw->scrActions.insert("shapeShowPalette", new ScrAction(QObject::tr("Custom Shapes"), QKeySequence(), mw));
-		mw->scrActions["shapeShowPalette"]->setToggleAction(true);
-		mw->scrActions["shapeShowPalette"]->setChecked(false);
-		connect(mw->scrActions["shapeShowPalette"], SIGNAL(toggled(bool)), sc_palette, SLOT(setPaletteShown(bool)));
-		connect(sc_palette, SIGNAL(paletteShown(bool)), mw->scrActions["shapeShowPalette"], SLOT(setChecked(bool)));
+		m_actions.insert("shapeShowPalette", new ScrAction(QObject::tr("Custom Shapes"), QKeySequence(), this));
+		m_actions["shapeShowPalette"]->setToggleAction(true);
+		m_actions["shapeShowPalette"]->setChecked(false);
+		connect(m_actions["shapeShowPalette"], SIGNAL(toggled(bool)), sc_palette, SLOT(setPaletteShown(bool)));
+		connect(sc_palette, SIGNAL(paletteShown(bool)), m_actions["shapeShowPalette"], SLOT(setChecked(bool)));
 		mw->scrMenuMgr->addMenuItemStringAfter("shapeShowPalette", "toolsInline", "Windows");
-		mw->scrMenuMgr->addMenuItemStringstoMenuBar("Windows", mw->scrActions);
+		mw->scrMenuMgr->addMenuItemStringstoMenuBar("Windows", m_actions);
 	}
 }
 

Modified: trunk/Scribus/scribus/plugins/shapes/shapeplugin.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19968&path=/trunk/Scribus/scribus/plugins/shapes/shapeplugin.h
==============================================================================
--- trunk/Scribus/scribus/plugins/shapes/shapeplugin.h (original)
+++ trunk/Scribus/scribus/plugins/shapes/shapeplugin.h Sat Apr  4 12:50:29 2015
@@ -7,10 +7,14 @@
 #ifndef SHAPEPLUG_H
 #define SHAPEPLUG_H
 
+#include <QMap>
+#include <QPointer>
+
 #include "scconfig.h"
 #include "scplugin.h"
 #include "pluginapi.h"
 #include "shapepalette.h"
+
 class ScrAction;
 class ScribusMainWindow;
 
@@ -30,6 +34,9 @@
 		virtual void languageChange();
 		virtual void addToMainWindowMenu(ScribusMainWindow *);
 		ShapePalette* sc_palette;
+
+	protected:
+		QMap<QString, QPointer<ScrAction> > m_actions;
 };
 
 extern "C" PLUGIN_API int shapeplugin_getPluginAPIVersion();




More information about the scribus-commit mailing list