aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMarkus Nißl <unknown>2024-01-18 09:11:07 +1100
committerMarkus Nißl <unknown>2024-01-18 09:11:07 +1100
commit26b41d025b55fc809fd28461968cf5e6779e29f5 (patch)
tree648465404d47efe31381e28de7d2b4f7dd54051d
parentb12c4ff365b8868fe9a85e87da92bc30d4f640ee (diff)
downloadscintilla-mirror-26b41d025b55fc809fd28461968cf5e6779e29f5.tar.gz
Use the multi-threaded option to Direct2D to avoid crashes when Scintilla
instances created on different threads.
-rw-r--r--doc/ScintillaHistory.html5
-rw-r--r--win32/PlatWin.cxx4
2 files changed, 7 insertions, 2 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 34013fe70..67f26fb3d 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -594,6 +594,11 @@
For ScintillaEdit on Qt, fix reference from ScintillaDocument to Document to match change in 5.4.1
using IDocumentEditable for SCI_GETDOCPOINTER and SCI_SETDOCPOINTER.
</li>
+ <li>
+ For Direct2D on Win32, use the multi-threaded option to avoid crashes when Scintilla instances
+ created on different threads. There may be more problems with this scenario so it should be avoided.
+ <a href="https://sourceforge.net/p/scintilla/bugs/2420/">Bug #2420</a>.
+ </li>
</ul>
<h3>
<a href="https://www.scintilla.org/scintilla541.zip">Release 5.4.1</a>
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 91af4a683..57d26a36a 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -98,8 +98,8 @@ void LoadD2DOnce() noexcept {
hDLLD2D = ::LoadLibraryEx(TEXT("D2D1.DLL"), 0, loadLibraryFlags);
D2D1CFSig fnD2DCF = DLLFunction<D2D1CFSig>(hDLLD2D, "D2D1CreateFactory");
if (fnD2DCF) {
- // A single threaded factory as Scintilla always draw on the GUI thread
- fnD2DCF(D2D1_FACTORY_TYPE_SINGLE_THREADED,
+ // A multi threaded factory in case Scintilla is used with multiple GUI threads
+ fnD2DCF(D2D1_FACTORY_TYPE_MULTI_THREADED,
__uuidof(ID2D1Factory),
nullptr,
reinterpret_cast<IUnknown**>(&pD2DFactory));