зеркало из https://github.com/mozilla/gecko-dev.git
Hold an nsWeakPtr ref to presshell like everyone else, not a raw weak ref. Bug
299494, r=brade, sr=jst, a=asa
This commit is contained in:
Родитель
612c02e3e7
Коммит
c6c7c99fe7
|
@ -514,14 +514,15 @@ nsTextEditorDragListener::DragGesture(nsIDOMEvent* aDragEvent)
|
|||
nsresult
|
||||
nsTextEditorDragListener::DragEnter(nsIDOMEvent* aDragEvent)
|
||||
{
|
||||
if (mPresShell)
|
||||
if (!mCaret)
|
||||
{
|
||||
if (!mCaret)
|
||||
nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(mPresShell);
|
||||
if (presShell)
|
||||
{
|
||||
mCaret = do_CreateInstance("@mozilla.org/layout/caret;1");
|
||||
if (mCaret)
|
||||
{
|
||||
mCaret->Init(mPresShell);
|
||||
mCaret->Init(presShell);
|
||||
mCaret->SetCaretReadOnly(PR_TRUE);
|
||||
}
|
||||
mCaretDrawn = PR_FALSE;
|
||||
|
|
|
@ -52,6 +52,9 @@
|
|||
#include "nsIEditor.h"
|
||||
#include "nsIPlaintextEditor.h"
|
||||
#include "nsICaret.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsIWeakReferenceUtils.h"
|
||||
|
||||
/** The nsTextEditorKeyListener public nsIDOMKeyListener
|
||||
* This class will delegate events to its editor according to the translation
|
||||
|
@ -206,7 +209,9 @@ public:
|
|||
* @param aEditor the editor this listener calls for editing operations
|
||||
*/
|
||||
void SetEditor(nsIEditor *aEditor) { mEditor = aEditor; }
|
||||
void SetPresShell(nsIPresShell *aPresShell) { mPresShell = aPresShell; }
|
||||
void SetPresShell(nsIPresShell *aPresShell) {
|
||||
mPresShell = do_GetWeakReference(aPresShell);
|
||||
}
|
||||
|
||||
/*interfaces for addref and release and queryinterface*/
|
||||
NS_DECL_ISUPPORTS
|
||||
|
@ -226,8 +231,8 @@ protected:
|
|||
|
||||
protected:
|
||||
|
||||
nsIEditor* mEditor;
|
||||
nsIPresShell* mPresShell;
|
||||
nsIEditor* mEditor;
|
||||
nsWeakPtr mPresShell;
|
||||
|
||||
nsCOMPtr<nsICaret> mCaret;
|
||||
PRBool mCaretDrawn;
|
||||
|
|
Загрузка…
Ссылка в новой задаче