[PATCH] Crash in meld trying to view moved file



Looking at debian bug report:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=471297

I tried the moved-file thing, and despite the reporter's
bug has been fixed by r1311, another crash follows:

Steps to reproduce:

####################################
mkdir gitmoved
cd gitmoved/
git init
Initialized empty Git repository in /tmp/gitmoved/.git/
touch test.txt
git add test.txt
git commit -a -m commitmsg
Created initial commit ef800aa: commitmsg
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 test.txt
git mv test.txt moved.txt
~/dev/svn/meld/trunk/meld moved.txt
Traceback (most recent call last):
  File "/home/vince/dev/svn/meld/trunk/task.py", line 130, in iteration
    ret = task()
  File "/home/vince/dev/svn/meld/trunk/vcview.py", line 329, in run_diff_iter
    self.show_patch(prefix, patch)
  File "/home/vince/dev/svn/meld/trunk/vcview.py", line 495, in show_patch
    misc.run_dialog(msg, parent=self)
  File "/home/vince/dev/svn/meld/trunk/misc.py", line 50, in run_dialog
    d.set_transient_for(parent.widget.get_toplevel())
TypeError: parent should be a GtkWindow or None
cd ~/dev/svn/meld/trunk && patch -p0 <
fix-run_dialog-set_transient_for-call.patch && cd -
~/dev/svn/meld/trunk/meld moved.txt
####################################

It should be noted that the bug does not happen if you
launch "meld ." instead of "meld moved.txt" and then
double click on moved.txt because in that case, parent
is a gtk.Window...

The attached patch fixes the symptom, I'm working
on a fix-for-the-cause (by only diffing modified files),
but  think the patch should go in regardless...

Comments ?

-- 
Vincent Legoll
Index: misc.py
===================================================================
--- misc.py	(revision 1327)
+++ misc.py	(working copy)
@@ -46,7 +46,7 @@
         messagetype,
         buttonstype,
         '<span weight="bold" size="larger">%s</span>' % escaped)
-    if parent:
+    if parent and isinstance(parent, gtk.Window):
         d.set_transient_for(parent.widget.get_toplevel())
     for b,rid in extrabuttons:
         d.add_button(b, rid)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]