The attached patch gets rid of the message
Object::disconnect: Unexpected null parameter
which often appears (at least in Linux) when closing buffers.

I get this message as a result of GuiView::closeBuffer(Buffer & buf) eventually 
calling GuiView::on_currentWorkAreaChanged(GuiWorkArea * wa) in the case that 
d.current_work_area_ is null.

d.current_work_area_ is set to wa shortly after so I don't see any other 
potential problems with it being null for a bit. I did not check if it was used 
outside of on_currentWorkAreaChanged though.

I am CC'ing Abdel because this code was recently (Oct. 2011) introduced in 
5c5850e2 so maybe he knows if there is a different fix or if 
d.current_work_area_ being null could cause other problems.

Thanks,

Scott
From 6b50077d5bd2bc9b3c5cdae2f06d13864f95dc60 Mon Sep 17 00:00:00 2001
From: Scott Kostyshak <skost...@princeton.edu>
Date: Tue, 14 Aug 2012 00:50:28 -0400
Subject: [PATCH] GuiView::on_currentWorkAreaChanged was passing
 Object::disconnect a null pointer (this happened when
 closing buffers).

---
 src/frontends/qt4/GuiView.cpp |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp
index 0237cb8..2affa8c 100644
--- a/src/frontends/qt4/GuiView.cpp
+++ b/src/frontends/qt4/GuiView.cpp
@@ -1022,8 +1022,9 @@ void GuiView::updateWindowTitle(GuiWorkArea * wa)
 
 void GuiView::on_currentWorkAreaChanged(GuiWorkArea * wa)
 {
-	QObject::disconnect(d.current_work_area_, SIGNAL(busy(bool)),
-		this, SLOT(setBusy(bool)));
+	if (d.current_work_area_)
+		QObject::disconnect(d.current_work_area_, SIGNAL(busy(bool)),
+			this, SLOT(setBusy(bool)));
 	disconnectBuffer();
 	disconnectBufferView();
 	connectBufferView(wa->bufferView());
-- 
1.7.9.5

Reply via email to