View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0002236 | Scribus | Internal | public | 2005-07-14 22:16 | 2005-08-11 21:48 |
| Reporter | jghali | Assigned To | |||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Platform | Windows | OS | Windows | OS Version | 2000 SP4 |
| Product Version | 1.3.0cvs | ||||
| Fixed in Version | 1.3.1cvs | ||||
| Summary | 0002236: Convert gtgettext.cpp to new plugin loading api | ||||
| Description | The attached diff allow gtgettext to use new plugin loading abstraction instead of qlibrary. | ||||
| Tags | No tags attached. | ||||
| Attached Files | gettext_plugin_loading_api.diff (3,094 bytes)
Index: gtgettext.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/gtgettext.cpp,v
retrieving revision 1.3.2.7
diff -u -r1.3.2.7 gtgettext.cpp
--- gtgettext.cpp 13 Mar 2005 15:09:20 -0000 1.3.2.7
+++ gtgettext.cpp 15 Jul 2005 00:00:34 -0000
@@ -18,8 +18,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
-#include "qlibrary.h"
-
#include "gtgettext.h"
#include "pluginmanager.h"
#include "scpaths.h"
@@ -121,47 +119,60 @@
void gtGetText::CallDLL(const ImporterData& idata, const QString& filePath,
const QString& encoding, bool textOnly, bool append)
{
+ void* gtplugin;
typedef void (*sdem)(QString filename, QString encoding, bool textOnly, gtWriter *writer);
sdem fp_GetText;
QString pluginFilePath = QString("%1/gettext/%2").arg(ScPaths::instance().pluginDir()).arg(idata.soFilePath);
- // This is the new, QLibrary based plugin loading code.
- QLibrary gtplugin(pluginFilePath);
- gtplugin.setAutoUnload(true);
- fp_GetText = (sdem)gtplugin.resolve("GetText");
+ gtplugin = PluginManager::loadDLL("pluginFilePath");
+ if (!gtplugin)
+ {
+ qWarning("Failed to load plugin %s", pluginFilePath.ascii());
+ return;
+ }
+ fp_GetText = (sdem) PluginManager::resolveSym(gtplugin, "GetText");
if (!fp_GetText)
{
qWarning("Failed to get GetText() from %s", pluginFilePath.ascii());
+ PluginManager::unloadDLL(gtplugin);
return;
}
gtWriter *w = new gtWriter(append);
(*fp_GetText)(filePath, encoding, textOnly, w);
delete w;
+ PluginManager::unloadDLL(gtplugin);
}
bool gtGetText::DLLName(QString name, QString *ffName, QStringList *fEndings)
{
+ void* gtplugin;
typedef QString (*sdem0)();
typedef QStringList (*sdem1)();
sdem0 fp_FileFormatName;
sdem1 fp_FileExtensions;
QString pluginFilePath = QString("%1/gettext/%2").arg(ScPaths::instance().pluginDir()).arg(name);
-
- QLibrary gtplugin(pluginFilePath);
- gtplugin.setAutoUnload(true);
- fp_FileFormatName = (sdem0)gtplugin.resolve("FileFormatName");
+ gtplugin = PluginManager::loadDLL(pluginFilePath);
+ if (!gtplugin)
+ {
+ qWarning("Failed to load plugin %s", pluginFilePath.ascii());
+ return false;
+ }
+ fp_FileFormatName = (sdem0) PluginManager::resolveSym( gtplugin, "FileFormatName");
if (!fp_FileFormatName)
{
qWarning("Failed to get FileFormatName() from %s", pluginFilePath.ascii());
+ PluginManager::unloadDLL(gtplugin);
return false;
}
- fp_FileExtensions = (sdem1)gtplugin.resolve("FileExtensions");
+ fp_FileExtensions = (sdem1) PluginManager::resolveSym( gtplugin, "FileExtensions");
if (!fp_FileExtensions)
{
qWarning("Failed to get FileExtensions() from %s", pluginFilePath.ascii());
+ PluginManager::unloadDLL(gtplugin);
return false;
}
*ffName = (*fp_FileFormatName)();
*fEndings = (*fp_FileExtensions)();
+ PluginManager::unloadDLL(gtplugin);
return true;
}
| ||||
| Patch | |||||
|
|
Looks good. Merged. |
|
|
It seems I was blind, deaf and dumb when merging that. No idea how I screwed up testing it. gtplugin = PluginManager::loadDLL("pluginFilePath"); != gtplugin = PluginManager::loadDLL(pluginFilePath); jghali, did you test to see that gettext worked on win32 before submitting this? |
|
|
Fixed in CVS, anyway. |
|
|
tested with compiled gettext plugins on win32, works. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2005-07-14 22:16 | jghali | New Issue | |
| 2005-07-14 22:16 | jghali | File Added: gettext_plugin_loading_api.diff | |
| 2005-07-15 05:53 |
|
Status | new => assigned |
| 2005-07-15 05:53 |
|
Assigned To | => ringerc |
| 2005-07-15 06:26 |
|
Status | assigned => resolved |
| 2005-07-15 06:26 |
|
Fixed in Version | => 1.3.1cvs |
| 2005-07-15 06:26 |
|
Resolution | open => fixed |
| 2005-07-15 06:26 |
|
Note Added: 0005589 | |
| 2005-07-15 07:37 |
|
Relationship added | related to 0000015 |
| 2005-07-15 07:41 |
|
Relationship replaced | child of 0000015 |
| 2005-07-16 19:19 |
|
Note Added: 0005611 | |
| 2005-07-16 19:20 |
|
Note Added: 0005612 | |
| 2005-08-11 21:48 | jghali | Status | resolved => closed |
| 2005-08-11 21:48 | jghali | Note Added: 0006078 |