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

Side by Side Diff: src/plugin/PluginClass.cpp

Issue 5189151393579008: Issue 2142 - Synchronize access to s_threadInstances in CPluginClass::OnTabChanged
Patch Set: Created March 16, 2015, 10:57 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 */ 602 */
603 STDMETHODIMP CPluginClass::OnTabChanged(DISPPARAMS* pDispParams, WORD wFlags) 603 STDMETHODIMP CPluginClass::OnTabChanged(DISPPARAMS* pDispParams, WORD wFlags)
604 { 604 {
605 DEBUG_GENERAL("Tab changed"); 605 DEBUG_GENERAL("Tab changed");
606 bool newtabshown = pDispParams->rgvarg[1].intVal==3; 606 bool newtabshown = pDispParams->rgvarg[1].intVal==3;
607 if (newtabshown) 607 if (newtabshown)
608 { 608 {
609 std::map<DWORD,CPluginClass*>::const_iterator it = s_threadInstances.find(Ge tCurrentThreadId()); 609 std::map<DWORD,CPluginClass*>::const_iterator it = s_threadInstances.find(Ge tCurrentThreadId());
610 if (it == s_threadInstances.end()) 610 if (it == s_threadInstances.end())
611 { 611 {
612 s_criticalSectionLocal.Lock();
Eric 2015/03/16 12:19:44 The atomic action required here needs to surround
612 s_threadInstances[::GetCurrentThreadId()] = this; 613 s_threadInstances[::GetCurrentThreadId()] = this;
614 s_criticalSectionLocal.Unlock();
613 if (!m_isInitializedOk) 615 if (!m_isInitializedOk)
614 { 616 {
615 m_isInitializedOk = true; 617 m_isInitializedOk = true;
616 InitObject(true); 618 InitObject(true);
617 UpdateStatusBar(); 619 UpdateStatusBar();
618 } 620 }
619 } 621 }
620 } 622 }
621 notificationMessage.Hide(); 623 notificationMessage.Hide();
622 DEBUG_GENERAL("Tab change end"); 624 DEBUG_GENERAL("Tab change end");
(...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1886 } 1888 }
1887 } 1889 }
1888 } 1890 }
1889 1891
1890 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); 1892 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT);
1891 } 1893 }
1892 1894
1893 return hTabWnd; 1895 return hTabWnd;
1894 1896
1895 } 1897 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld