Bug 87533 - Javascript close crashes Quanta
Summary: Javascript close crashes Quanta
Status: RESOLVED FIXED
Alias: None
Product: quanta
Classification: Miscellaneous
Component: general (show other bugs)
Version: 3.2.2
Platform: Debian testing Linux
: NOR crash
Target Milestone: ---
Assignee: András Manţia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-19 20:14 UTC by Mikko Yliniemi
Modified: 2004-09-12 22:49 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mikko Yliniemi 2004-08-19 20:14:43 UTC
Version:           3.2.2 (using KDE KDE 3.2.3)
Installed from:    Debian testing/unstable Packages
OS:                Linux

I click new file, then add this line to it:

<a href="javascript:window.close();">Close window</a>

Then I hit F6 to see what page looks like and click the link, nothing happens. Then I hit F6 again and Quanta crashes.
Comment 1 András Manţia 2004-08-20 15:41:37 UTC
Please try Quanta 3.3 final and report if the bug is still there or not. 
Unfortunately we don't have time and enough manpower to maitain the 
3.2.x line anymore.

Comment 2 Mikko Yliniemi 2004-08-24 17:24:40 UTC
Same problem with 3.3

Using host libthread_db library "/lib/tls/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread 1103071904 (LWP 947)]
0x4172240e in __waitpid_nocancel () from /lib/tls/libpthread.so.0
#0  0x4172240e in __waitpid_nocancel () from /lib/tls/libpthread.so.0
#1  0x40e73dd0 in KCrash::defaultCrashHandler () from /usr/lib/libkdecore.so.4
#2  <signal handler called>
#3  0x4035e07a in KHTMLPart::view () from /usr/lib/libkhtml.so.4
#4  0x080cbc82 in QuantaApp::slotShowPreview ()
#5  0x080e52af in QuantaApp::qt_invoke ()
#6  0x41259e9c in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#7  0x41259cc4 in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#8  0x40b9dacb in KAction::activated () from /usr/lib/libkdeui.so.4
#9  0x40b9d4af in KAction::slotActivated () from /usr/lib/libkdeui.so.4
#10 0x40b9dcd1 in KAction::qt_invoke () from /usr/lib/libkdeui.so.4
#11 0x40bb35dd in KToolBarPopupAction::qt_invoke () from /usr/lib/libkdeui.so.4
#12 0x41259e9c in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#13 0x41259cc4 in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#14 0x40e6e38b in KAccelPrivate::menuItemActivated ()
   from /usr/lib/libkdecore.so.4
#15 0x40e6cc0c in KAccelPrivate::eventFilter () from /usr/lib/libkdecore.so.4
#16 0x412579be in QObject::activate_filters () from /usr/lib/libqt-mt.so.3
#17 0x412578ec in QObject::event () from /usr/lib/libqt-mt.so.3
#18 0x4128f5af in QWidget::event () from /usr/lib/libqt-mt.so.3
#19 0x4134c032 in QMainWindow::event () from /usr/lib/libqt-mt.so.3
#20 0x082c8eaf in KMdiMainFrm::event ()
#21 0x411fdaff in QApplication::internalNotify () from /usr/lib/libqt-mt.so.3
#22 0x411fd5f4 in QApplication::notify () from /usr/lib/libqt-mt.so.3
#23 0x40deeaf9 in KApplication::notify () from /usr/lib/libkdecore.so.4
#24 0x40e6bb7d in KAccelEventHandler::x11Event () from /usr/lib/libkdecore.so.4
#25 0x40df4482 in KApplication::x11EventFilter () from /usr/lib/libkdecore.so.4
#26 0x41188748 in qt_set_x11_event_filter () from /usr/lib/libqt-mt.so.3
#27 0x41191feb in QApplication::x11ProcessEvent () from /usr/lib/libqt-mt.so.3
#28 0x411a87d4 in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3
#29 0x41211498 in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
#30 0x41211348 in QEventLoop::exec () from /usr/lib/libqt-mt.so.3
#31 0x411fdd51 in QApplication::exec () from /usr/lib/libqt-mt.so.3
#32 0x080abd04 in main ()
Comment 3 András Manţia 2004-09-12 22:49:48 UTC
CVS commit by amantia: 

Evil bug with evil solution: one can delete our HTML part from JavaScript, so re-create if this happens...
Backport will follow.

CCMAIL: 87533-done@bugs.kde.org


  M +1 -1      quanta.kdevelop   1.239
  M +0 -1      parts/preview/whtmlpart.h   1.9
  M +40 -2     src/quanta.cpp   1.624
  M +6 -0      src/quanta.h   1.266
  M +6 -17     src/quanta_init.cpp   1.559


--- kdewebdev/quanta/quanta.kdevelop  #1.238:1.239
@@ -169,5 +169,5 @@
     <tree>
       <hidenonprojectfiles>false</hidenonprojectfiles>
-      <hidepatterns></hidepatterns>
+      <hidepatterns/>
       <showvcsfields>true</showvcsfields>
     </tree>

--- kdewebdev/quanta/src/quanta.cpp  #1.623:1.624
@@ -253,4 +253,6 @@ QuantaApp::QuantaApp(int mdiMode) : DCOP
 QuantaApp::~QuantaApp()
 {
+  disconnect(m_htmlPart, SIGNAL(destroyed(QObject *)));
+  disconnect(m_htmlPartDoc, SIGNAL(destroyed(QObject *)));
   disconnect(this, SIGNAL(lastChildViewClosed()), ViewManager::ref(), SLOT(slotLastViewClosed()));
 // kdDebug(24000) << "QuantaApp::~QuantaApp" << endl;
@@ -2944,6 +2946,9 @@ void QuantaApp::focusInEvent(QFocusEvent
  KDockMainWindow::focusInEvent(e);
  Document *w = ViewManager::ref()->activeDocument();
+ if (w)
+ {
  w->view()->setFocus();
  w->checkDirtyStatus();
+ }
 }
 
@@ -4829,3 +4834,36 @@ void QuantaApp::setTabToolTip(QWidget *w
 }
 
+void QuantaApp::createPreviewPart()
+{
+  m_htmlPart = new WHTMLPart(this, "rightHTML");
+  m_htmlPart->view()->resize(0, 0);
+  m_htmlPart->view()->setIcon(UserIcon("preview"));
+  m_htmlPart->view()->setCaption(i18n("Preview"));
+  slotNewPart(m_htmlPart, false);
+  connect(m_htmlPart, SIGNAL(previewHasFocus(bool)), this, SLOT(slotPreviewHasFocus(bool)));
+  connect(m_htmlPart, SIGNAL(destroyed(QObject *)), this, SLOT(slotHTMLPartDeleted(QObject *)));
+
+}
+
+void QuantaApp::createDocPart()
+{
+  m_htmlPartDoc = new WHTMLPart(this, "docHTML");
+  m_htmlPartDoc->view()->resize(0, 0);
+  m_htmlPartDoc->view()->setIcon(SmallIcon("contents"));
+  m_htmlPartDoc->view()->setCaption(i18n("Documentation"));
+  slotNewPart(m_htmlPartDoc, false);
+  connect(m_htmlPartDoc, SIGNAL(destroyed(QObject *)), this, SLOT(slotHTMLPartDeleted(QObject *)));
+}
+
+void QuantaApp::slotHTMLPartDeleted(QObject *object)
+{
+  if (object == m_htmlPart)
+  {
+     createPreviewPart();
+     slotShowPreviewWidget(false);
+  } else
+     createDocPart();
+}
+
+
 #include "quanta.moc"

--- kdewebdev/quanta/src/quanta.h  #1.265:1.266
@@ -201,4 +201,7 @@ public:
   void setTabToolTip(QWidget *w, const QString& toolTipStr);
 
+  void createPreviewPart();
+  void createDocPart();
+
   /** Clicked word or selected text for context sensitive menu in editor */
   QString popupWord;
@@ -371,4 +374,7 @@ public slots:
   void slotCVSCommandExecuted(const QString &command, const QStringList &files);
 
+  /** Called when the preview or documentation part is deleted. */
+  void slotHTMLPartDeleted(QObject *object);
+
 //Overridden KMdiMainFrm slots
   virtual void closeAllViews();

--- kdewebdev/quanta/src/quanta_init.cpp  #1.558:1.559
@@ -459,17 +459,6 @@ void QuantaInit::initView()
   m_quanta->m_problemOutput->setFocusPolicy(QWidget::NoFocus);
 
-  m_quanta->m_htmlPart = new WHTMLPart(m_quanta, "rightHTML");
-  m_quanta->m_htmlPart->view()->resize(0, 0);
-  m_quanta->m_htmlPart->view()->setIcon(UserIcon("preview"));
-  m_quanta->m_htmlPart->view()->setCaption(i18n("Preview"));
-  m_quanta->slotNewPart(m_quanta->m_htmlPart, false);
-  connect(m_quanta->m_htmlPart, SIGNAL(previewHasFocus(bool)), m_quanta, SLOT(slotPreviewHasFocus(bool)));
-
-
-  m_quanta->m_htmlPartDoc = new WHTMLPart(m_quanta, "docHTML");
-  m_quanta->m_htmlPartDoc->view()->resize(0, 0);
-  m_quanta->m_htmlPartDoc->view()->setIcon(SmallIcon("contents"));
-  m_quanta->m_htmlPartDoc->view()->setCaption(i18n("Documentation"));
-  m_quanta->slotNewPart(m_quanta->m_htmlPartDoc, false);
+  m_quanta->createPreviewPart();
+  m_quanta->createDocPart();
 
   connect(m_quanta, SIGNAL(reloadAllTrees()),