Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: shell/src/Main.cpp

Issue 10173031: Don`t use references to JsEngine to avoid use-after-free errors,switch to shared_ptr instead (Closed)
Patch Set: Created April 18, 2013, 4:15 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 #include <AdblockPlus.h> 1 #include <AdblockPlus.h>
2 #include <iostream> 2 #include <iostream>
3 #include <sstream> 3 #include <sstream>
4 4
5 #include "GcCommand.h" 5 #include "GcCommand.h"
6 #include "HelpCommand.h" 6 #include "HelpCommand.h"
7 #include "FiltersCommand.h" 7 #include "FiltersCommand.h"
8 #include "SubscriptionsCommand.h" 8 #include "SubscriptionsCommand.h"
9 #include "MatchesCommand.h" 9 #include "MatchesCommand.h"
10 10
(...skipping 22 matching lines...) Expand all
33 } 33 }
34 } 34 }
35 35
36 int main() 36 int main()
37 { 37 {
38 try 38 try
39 { 39 {
40 AdblockPlus::AppInfo appInfo; 40 AdblockPlus::AppInfo appInfo;
41 appInfo.version = "1.0"; 41 appInfo.version = "1.0";
42 appInfo.name = "Adblock Plus Shell"; 42 appInfo.name = "Adblock Plus Shell";
43 AdblockPlus::JsEngine jsEngine(appInfo); 43 AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New(appInfo));
44 AdblockPlus::FilterEngine filterEngine(jsEngine); 44 AdblockPlus::FilterEngine filterEngine(jsEngine);
45 45
46 CommandMap commands; 46 CommandMap commands;
47 Add(commands, new GcCommand(jsEngine)); 47 Add(commands, new GcCommand(jsEngine));
48 Add(commands, new HelpCommand(commands)); 48 Add(commands, new HelpCommand(commands));
49 Add(commands, new FiltersCommand(filterEngine)); 49 Add(commands, new FiltersCommand(filterEngine));
50 Add(commands, new SubscriptionsCommand(filterEngine)); 50 Add(commands, new SubscriptionsCommand(filterEngine));
51 Add(commands, new MatchesCommand(filterEngine)); 51 Add(commands, new MatchesCommand(filterEngine));
52 52
53 std::string commandLine; 53 std::string commandLine;
(...skipping 15 matching lines...) Expand all
69 std::cout << error.what() << std::endl; 69 std::cout << error.what() << std::endl;
70 } 70 }
71 } 71 }
72 } 72 }
73 catch (const std::exception& e) 73 catch (const std::exception& e)
74 { 74 {
75 std::cerr << "Exception: " << e.what() << std::endl; 75 std::cerr << "Exception: " << e.what() << std::endl;
76 } 76 }
77 return 0; 77 return 0;
78 } 78 }
OLDNEW
« no previous file with comments | « shell/src/GcCommand.cpp ('k') | src/AppInfoJsObject.h » ('j') | src/JsEngine.cpp » ('J')

Powered by Google App Engine
This is Rietveld