← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2980: make the sample plugin loadable by DC++

 

------------------------------------------------------------
revno: 2980
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Tue 2012-07-03 19:17:03 +0200
message:
  make the sample plugin loadable by DC++
modified:
  dcpp/PluginManager.cpp
  plugins/SamplePlugin/SConscript
  win32/PluginPage.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'dcpp/PluginManager.cpp'
--- dcpp/PluginManager.cpp	2012-07-02 21:37:23 +0000
+++ dcpp/PluginManager.cpp	2012-07-03 17:17:03 +0000
@@ -189,7 +189,7 @@
 
 vector<PluginInfo*> PluginManager::getPluginList() const {
 	Lock l(cs);
-	vector<PluginInfo*> ret;
+	vector<PluginInfo*> ret(plugins.size());
 	std::transform(plugins.begin(), plugins.end(), ret.begin(),
 		[](const unique_ptr<PluginInfo>& p) { return p.get(); });
 	return ret;

=== modified file 'plugins/SamplePlugin/SConscript'
--- plugins/SamplePlugin/SConscript	2012-07-02 21:37:23 +0000
+++ plugins/SamplePlugin/SConscript	2012-07-03 17:17:03 +0000
@@ -4,4 +4,12 @@
 
 env.Append(CPPPATH = ['#/dcpp'])
 
-ret = dev.build_lib(env, target, sources, shared = True)
+res = env.RES(dev.get_sources(source_path, '*.rc'))
+env.Depends(res, 'resource.h')
+
+if 'g++' in env['LINK']:
+	env.Append(SHLINKFLAGS = '-Wl,--add-stdcall-alias')
+elif 'link' in env['LINK']:
+	sources.append('Plugin.def')
+
+ret = dev.build_lib(env, target, [sources, res], shared = True)

=== modified file 'win32/PluginPage.cpp'
--- win32/PluginPage.cpp	2012-07-02 18:13:18 +0000
+++ win32/PluginPage.cpp	2012-07-03 17:17:03 +0000
@@ -187,7 +187,10 @@
 
 	HoldRedraw hold(pluginInfo);
 
-	boost::for_each(pluginInfo->getChildren<Control>(), [](Control *w) { w->close(); });
+	/* destroy previous children. store them in a vector beforehand or the enumeration will fail
+	(since they're getting destroyed)... */
+	auto children = pluginInfo->getChildren<Control>();
+	boost::for_each(std::vector<Control*>(children.first, children.second), [](Control* w) { w->close(); });
 
 	pluginInfo->clearRows();