Patch #2072 2007-06-21 23:25

dmoore

disable scintilla hooks during file open
Download
2072-disable_scinti.patch (1.6 KB)
Category
Application::Bugfix
Status
Accepted
Close date
2007-06-22 01:07
Assigned to
rickg22
Index: src/sdk/cbeditor.cpp
===================================================================
--- src/sdk/cbeditor.cpp    (revision 4149)
+++ src/sdk/cbeditor.cpp    (working copy)
@@ -456,6 +456,7 @@
     // if we add more constructors in the future, don't forget to set this!
     m_pData = new cbEditorInternalData(this);
     m_IsBuiltinEditor = true;
+    m_hookslocked=false;

     if (!filename.IsEmpty())
     {
@@ -1161,6 +1162,7 @@
     if (!wxFileExists(m_Filename))
         return false;

+    m_hookslocked=true;
     // open file
     m_pControl->SetReadOnly(false);
     wxString st;
@@ -1169,7 +1171,10 @@
     wxFile file(m_Filename);

     if (!file.IsOpened())
+    {
+        m_hookslocked=false;
         return false;
+    }

     m_pControl->SetModEventMask(0);
     if (detectEncoding)
@@ -1197,6 +1202,9 @@
     m_pControl->SetZoom(Manager::Get()->GetEditorManager()->GetZoom());
     if (m_pControl2)
         m_pControl2->SetZoom(Manager::Get()->GetEditorManager()->GetZoom());
+
+    m_hookslocked=false;
+
     return true;
 }

@@ -2522,6 +2530,8 @@
 // generic scintilla event handler
 void cbEditor::OnScintillaEvent(wxScintillaEvent& event)
 {
+    if(m_hookslocked)
+        return;
     // call any hooked functors
     if (EditorHooks::HasRegisteredHooks())
     {
Index: src/include/cbeditor.h
===================================================================
--- src/include/cbeditor.h    (revision 4149)
+++ src/include/cbeditor.h    (working copy)
@@ -341,6 +341,7 @@
         void DestroySplitView();

         // variables
+        bool m_hookslocked;
         bool m_IsOK;
         wxSplitterWindow* m_pSplitter;
         wxBoxSizer* m_pSizer;
rickg22 2007-06-22 01:07

Altho the patch was NOT applied, an equivalent solution was applied. Thanks!