Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
60e67b38
Kaydet (Commit)
60e67b38
authored
Ara 18, 2015
tarafından
Noel Grandin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fix O(n^2) in vcl event broadcasting tdf#90199
Change-Id: If3d7514364589058334369432cdcf4f7586c239d
üst
68f411fb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
5 deletions
+20
-5
window.h
vcl/inc/window.h
+3
-0
event.cxx
vcl/source/window/event.cxx
+17
-5
No files found.
vcl/inc/window.h
Dosyayı görüntüle @
60e67b38
...
...
@@ -39,6 +39,7 @@
#include <vcl/rendersettings.hxx>
#include "vcleventlisteners.hxx"
#include <vector>
#include <set>
struct
SalPaintEvent
;
struct
ImplDelData
;
...
...
@@ -231,6 +232,8 @@ public:
VclPtr
<
vcl
::
Window
>
mpDlgCtrlDownWindow
;
std
::
vector
<
Link
<
VclWindowEvent
&
,
void
>>
maEventListeners
;
std
::
vector
<
Link
<
VclWindowEvent
&
,
void
>>
maChildEventListeners
;
int
maChildEventListenersIteratingCount
;
std
::
set
<
Link
<
VclWindowEvent
&
,
void
>>
maChildEventListenersDeleted
;
// The canvas interface for this VCL window. Is persistent after the first GetCanvas() call
css
::
uno
::
WeakReference
<
css
::
rendering
::
XCanvas
>
mxCanvas
;
...
...
vcl/source/window/event.cxx
Dosyayı görüntüle @
60e67b38
...
...
@@ -30,6 +30,7 @@
#include <com/sun/star/awt/MouseEvent.hpp>
#include <com/sun/star/awt/KeyModifier.hpp>
#include <com/sun/star/awt/MouseButton.hpp>
#include <comphelper/scopeguard.hxx>
namespace
vcl
{
...
...
@@ -238,17 +239,26 @@ void Window::CallEventListeners( sal_uLong nEvent, void* pData )
if
(
aDelData
.
IsDead
()
)
return
;
auto
&
r
ChildListeners
=
pWindow
->
mpWindowImpl
->
maChildEventListeners
;
if
(
!
r
Child
Listeners
.
empty
())
auto
&
r
WindowImpl
=
*
pWindow
->
mpWindowImpl
;
if
(
!
r
WindowImpl
.
maChildEvent
Listeners
.
empty
())
{
// Copy the list, because this can be destroyed when calling a Link...
std
::
vector
<
Link
<
VclWindowEvent
&
,
void
>>
aCopy
(
rChildListeners
);
std
::
vector
<
Link
<
VclWindowEvent
&
,
void
>>
aCopy
(
rWindowImpl
.
maChildEventListeners
);
// we use an iterating counter/flag and a set of deleted Link's to avoid O(n^2) behaviour
rWindowImpl
.
maChildEventListenersIteratingCount
++
;
comphelper
::
ScopeGuard
aGuard
(
[
&
rWindowImpl
]()
{
if
(
--
rWindowImpl
.
maChildEventListenersIteratingCount
==
0
)
rWindowImpl
.
maChildEventListenersDeleted
.
clear
();
}
);
for
(
Link
<
VclWindowEvent
&
,
void
>&
rLink
:
aCopy
)
{
if
(
aDelData
.
IsDead
())
return
;
//
check this hasn't been removed in some re-enterancy scenario fdo#47368
if
(
std
::
find
(
rChildListeners
.
begin
(),
rChildListeners
.
end
(),
rLink
)
!=
rChildListeners
.
end
()
)
//
Check this hasn't been removed in some re-enterancy scenario fdo#47368.
if
(
rWindowImpl
.
maChildEventListenersDeleted
.
find
(
rLink
)
!=
rWindowImpl
.
maChildEventListenersDeleted
.
end
()
)
rLink
.
Call
(
aEvent
);
}
}
...
...
@@ -292,6 +302,8 @@ void Window::RemoveChildEventListener( const Link<VclWindowEvent&,void>& rEventL
{
auto
&
rListeners
=
mpWindowImpl
->
maChildEventListeners
;
rListeners
.
erase
(
std
::
remove
(
rListeners
.
begin
(),
rListeners
.
end
(),
rEventListener
),
rListeners
.
end
()
);
if
(
mpWindowImpl
->
maChildEventListenersIteratingCount
)
mpWindowImpl
->
maChildEventListenersDeleted
.
insert
(
rEventListener
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment