Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of clone and fake in GUI #2665

Merged
merged 9 commits into from
Feb 8, 2019

Conversation

DasSkelett
Copy link
Member

@DasSkelett DasSkelett commented Jan 22, 2019

My attempt to implement the clone and fake functions in the GUI.

Accessible via File > Select KSP Install >New KSP instance > Clone or fake new instance:
grafik

The window itself looks like this:
screenshot_20190122_214241 or on windows:
grafik
Won't win beauty prizes with that, but it works (hopefully).

Should be pretty self-explanatory (haha).
Has all the features of the CLI implementation:

  • Clone:
    • Select instance by name or path
    • Enter path manually or open the folder browser dialog
  • Fake
    • Select KSP version out of a drop down combo box (sorted from newest to oldest)
    • Enter DLC version manually or leave empty to create none
  • Set new instance as default and/or switch to it right after

@HebaruSan HebaruSan added Enhancement New features or functionality GUI Issues affecting the interactive GUI Pull request labels Jan 23, 2019
@HebaruSan
Copy link
Member

HebaruSan commented Jan 23, 2019

Can we make this a dropdown option on the "Add new" button in the instance selection window instead? We have a DropdownMenuButton class that ought to work.

image

Use RaiseMessage instead of RaiseProgress
Call UpdateInstancesList() at the end of the clone/fake tasks to update the listt in the instance selection dialog
@DasSkelett
Copy link
Member Author

So have it now as a suboption of the KSP selection dialog, see the screenshot in the PR message.

One more thing: I now pass the current ChooseKSPInstance form to the CloneFakeKspDialog constructor to be able to call UpdateInstancesList() at the end of the tasks. Is there another, better way to do this?

@HebaruSan
Copy link
Member

HebaruSan commented Jan 23, 2019

I get this when I click Select Known Instance:

System.NullReferenceException: Object reference not set to an instance of an object
  at CKAN.CloneFakeKspDialog.buttonOpenInstanceSelection_Click (System.Object sender, System.EventArgs e) [0x00040] in <0a0094f163b8419298a3bbe61211536d>:0 
  at System.Windows.Forms.Control.OnClick (System.EventArgs e) [0x00019] in <895eff5fc3c3440985711e3d9bfab833>:0 
  at System.Windows.Forms.Button.OnClick (System.EventArgs e) [0x0001e] in <895eff5fc3c3440985711e3d9bfab833>:0 
  at System.Windows.Forms.ButtonBase.OnMouseUp (System.Windows.Forms.MouseEventArgs mevent) [0x00069] in <895eff5fc3c3440985711e3d9bfab833>:0 
  at System.Windows.Forms.Button.OnMouseUp (System.Windows.Forms.MouseEventArgs mevent) [0x00000] in <895eff5fc3c3440985711e3d9bfab833>:0 
  at System.Windows.Forms.Control.WmLButtonUp (System.Windows.Forms.Message& m) [0x00078] in <895eff5fc3c3440985711e3d9bfab833>:0 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x001b4] in <895eff5fc3c3440985711e3d9bfab833>:0 
  at System.Windows.Forms.ButtonBase.WndProc (System.Windows.Forms.Message& m) [0x00037] in <895eff5fc3c3440985711e3d9bfab833>:0 
  at System.Windows.Forms.Button.WndProc (System.Windows.Forms.Message& m) [0x00000] in <895eff5fc3c3440985711e3d9bfab833>:0 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <895eff5fc3c3440985711e3d9bfab833>:0 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x0000b] in <895eff5fc3c3440985711e3d9bfab833>:0 
  at System.Windows.Forms.NativeWindow.WndProc (System.IntPtr hWnd, System.Windows.Forms.Msg msg, System.IntPtr wParam, System.IntPtr lParam) [0x00085] in <895eff5fc3c3440985711e3d9bfab833>:0 

I think it's because instance.Version() is null for one of my instances.

@HebaruSan
Copy link
Member

Let's set the menu's renderer in Mono so it'll look nice with dark themes:

if (Platform.IsMono)
{
this.ClearCacheMenu.Renderer = new FlatToolStripRenderer();
}

@HebaruSan
Copy link
Member

HebaruSan commented Jan 23, 2019

I think this is a different problem, happens if I click Select Known Instance when the select instance window appears at startup (so before the main form has displayed):

System.NullReferenceException: Object reference not set to an instance of an object
  at CKAN.Main.SelectionDialog (System.String message, System.Object[] args) [0x00001] in <7070f5e3dbeb421abb2884e3a1da043d>:0 
  at (wrapper remoting-invoke-with-check) CKAN.Main.SelectionDialog(string,object[])
  at CKAN.GUIUser.RaiseSelectionDialog (System.String message, System.Object[] args) [0x00006] in <7070f5e3dbeb421abb2884e3a1da043d>:0 
  at CKAN.CloneFakeKspDialog.buttonOpenInstanceSelection_Click (System.Object sender, System.EventArgs e) [0x0005f] in <7070f5e3dbeb421abb2884e3a1da043d>:0 
  at System.Windows.Forms.Control.OnClick (System.EventArgs e) [0x00019] in <895eff5fc3c3440985711e3d9bfab833>:0 
  at System.Windows.Forms.Button.OnClick (System.EventArgs e) [0x0001e] in <895eff5fc3c3440985711e3d9bfab833>:0 
  at System.Windows.Forms.ButtonBase.OnMouseUp (System.Windows.Forms.MouseEventArgs mevent) [0x00069] in <895eff5fc3c3440985711e3d9bfab833>:0 
  at System.Windows.Forms.Button.OnMouseUp (System.Windows.Forms.MouseEventArgs mevent) [0x00000] in <895eff5fc3c3440985711e3d9bfab833>:0 
  at System.Windows.Forms.Control.WmLButtonUp (System.Windows.Forms.Message& m) [0x00078] in <895eff5fc3c3440985711e3d9bfab833>:0 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x001b4] in <895eff5fc3c3440985711e3d9bfab833>:0 
  at System.Windows.Forms.ButtonBase.WndProc (System.Windows.Forms.Message& m) [0x00037] in <895eff5fc3c3440985711e3d9bfab833>:0 
  at System.Windows.Forms.Button.WndProc (System.Windows.Forms.Message& m) [0x00000] in <895eff5fc3c3440985711e3d9bfab833>:0 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <895eff5fc3c3440985711e3d9bfab833>:0 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x0000b] in <895eff5fc3c3440985711e3d9bfab833>:0 
  at System.Windows.Forms.NativeWindow.WndProc (System.IntPtr hWnd, System.Windows.Forms.Msg msg, System.IntPtr wParam, System.IntPtr lParam) [0x00085] in <895eff5fc3c3440985711e3d9bfab833>:0 

Presumably Main.selectionDialog is null because RecreateDialogs hasn't been called yet.

@DasSkelett
Copy link
Member Author

DasSkelett commented Jan 24, 2019

Yep, get it too. The call stack:

CKAN-GUI.exe!CKAN.Main.SelectionDialog(string message = "Choose an existing instance:", object[] args = {string[2]}) Zeile 47	C#
CKAN-GUI.exe!CKAN.GUIUser.RaiseSelectionDialog(string message = "Choose an existing instance:", object[] args = {string[2]}) Zeile 37	C#
CKAN-GUI.exe!CKAN.CloneFakeKspDialog.buttonOpenInstanceSelection_Click(object sender = {Text = "Select Known Instance"}, System.EventArgs e = {X = 117 Y = 10 Button = Left}) Zeile 69	C#

This part:

public int SelectionDialog(string message, params object[] args)
{
    return selectionDialog.ShowSelectionDialog(message, args);
}

There selectionDialog is null because it is not initialised yet.

Edit: well, you got it too in your comment, didn't see the edit before I typed mine.

@HebaruSan
Copy link
Member

There doesn't seem to be any validation around the selection of the instance to be cloned. I can put garbage in the text box and click OK, and instead of an error it just closes the dialog and returns me to the original list of instances.

image

@DasSkelett
Copy link
Member Author

Yeah, actually I completely forgot to process direct textbox inputs. It does nothing whether the path is valid or not.

@DasSkelett
Copy link
Member Author

Calling RecreateDialogs() before we do the null checks for current and/or preferred instance would solve the selectionDialog being null issue. Does anything speak against this?

Fix `NullReferenceException` for broken KSP installs
Fix `NullReferenceException` if you open the dialog at startup
Set the dropdown menu renderer in mono
Consider manual path textbox entries for clone and validate them
Better handle the tasks, don't close window before they finished, but show progress bar
@DasSkelett
Copy link
Member Author

This should solve all the issues @HebaruSan reported yet.
The clone/fake processes still are executed in tasks so they don't block the UI thread, but the window won't close until they finished. A progressbar is shown to indicate to the user that something happens. All controls are deactivated. Theoretically this wouldn't be necessary, but it's safer, I think.

I moved RecreateDialogs() further up in Main() so they are available for the clone/fake dialog if it's opened at startup (see above discussion).

I close the dialog window out of the tasks, so I need to invoke the this.Close() method on the UI thread. Util.Invoke() throws an ObjectDisposedException there, don't exactly know why, but I catch and ignore it, because dispossing the form is exactly what we want...

@HebaruSan
Copy link
Member

HebaruSan commented Jan 24, 2019

There's still something fishy with the validation and/or threading. If I open the dialog and click OK it says to fill in the new name and path, and then if I click OK again after doing that I get a very hard crash.

48320 [Thread Pool Worker] ERROR CKAN.ErrorDialog (null) - The instance you wanted to clone is not valid: /home/paul/You can enter a path here
[xcb] Too much data requested from _XRead
[xcb] This is most likely caused by a broken X extension library
[xcb] Aborting, sorry about that.
cli: ../../src/xcb_io.c:742: _XRead: Assertion `!xcb_xlib_too_much_data_requested' failed.
Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Windows.Forms.X11Keyboard.XCreateFontSet (intptr,string,intptr&,int&,intptr) [0x0000b] in <895eff5fc3c3440985711e3d9bfab833>:0
  at System.Windows.Forms.X11Keyboard.CreateOverTheSpotXic (intptr,intptr) [0x00023] in <895eff5fc3c3440985711e3d9bfab833>:0
  at System.Windows.Forms.X11Keyboard.CreateXic (intptr,intptr) [0x00042] in <895eff5fc3c3440985711e3d9bfab833>:0
  at System.Windows.Forms.X11Keyboard.CreateXicForWindow (intptr) [0x00000] in <895eff5fc3c3440985711e3d9bfab833>:0
  at System.Windows.Forms.X11Keyboard.FocusIn (intptr) [0x00032] in <895eff5fc3c3440985711e3d9bfab833>:0
  at System.Windows.Forms.XplatUIX11.SetFocus (intptr) [0x00054] in <895eff5fc3c3440985711e3d9bfab833>:0
  at System.Windows.Forms.XplatUI.SetFocus (intptr) [0x00000] in <895eff5fc3c3440985711e3d9bfab833>:0
  at System.Windows.Forms.ContainerControl.SendControlFocus (System.Windows.Forms.Control) [0x00016] in <895eff5fc3c3440985711e3d9bfab833>:0
  at System.Windows.Forms.Form.SetVisibleCore (bool) [0x0017d] in <895eff5fc3c3440985711e3d9bfab833>:0
  at System.Windows.Forms.Control.set_Visible (bool) [0x00009] in <895eff5fc3c3440985711e3d9bfab833>:0
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control.set_Visible (bool) [0x00032] in <895eff5fc3c3440985711e3d9bfab833>:0
  at System.Windows.Forms.Application.RunLoop (bool,System.Windows.Forms.ApplicationContext) [0x00059] in <895eff5fc3c3440985711e3d9bfab833>:0
  at System.Windows.Forms.Form.ShowDialog (System.Windows.Forms.IWin32Window) [0x001b7] in <895eff5fc3c3440985711e3d9bfab833>:0
  at System.Windows.Forms.Form.ShowDialog () [0x00000] in <895eff5fc3c3440985711e3d9bfab833>:0
  at CKAN.ErrorDialog.ShowErrorDialog (string,object[]) [0x0007a] in <e881bc6766b64472aa43dedd4170f4d7>:0
  at (wrapper remoting-invoke-with-check) CKAN.ErrorDialog.ShowErrorDialog (string,object[]) [0x00033] in <e881bc6766b64472aa43dedd4170f4d7>:0
  at CKAN.Main.ErrorDialog (string,object[]) [0x0000e] in <e881bc6766b64472aa43dedd4170f4d7>:0
  at (wrapper remoting-invoke-with-check) CKAN.Main.ErrorDialog (string,object[]) [0x00033] in <e881bc6766b64472aa43dedd4170f4d7>:0
  at CKAN.GUIUser.RaiseError (string,object[]) [0x00006] in <e881bc6766b64472aa43dedd4170f4d7>:0
  at CKAN.CloneFakeKspDialog/<>c__DisplayClass6_0.<buttonOK_Click>b__0 () [0x0009f] in <e881bc6766b64472aa43dedd4170f4d7>:0
  at System.Threading.Tasks.Task.InnerInvoke () <0x0004e>
  at System.Threading.Tasks.Task.Execute () <0x00024>
  at System.Threading.Tasks.Task.ExecutionContextCallback (object) <0x00028>
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) <0x00171>
  at System.Threading.Tasks.Task.ExecuteWithThreadLocal (System.Threading.Tasks.Task&) <0x000b2>
  at System.Threading.Tasks.Task.ExecuteEntry (bool) <0x0010f>
  at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () <0x00007>
  at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in <04750267503a43e5929c1d1ba19daf3e>:0
  at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () <0x00005>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_bool (object,intptr,intptr,intptr) [0x0001e] in <04750267503a43e5929c1d1ba19daf3e>:0
/proc/self/maps:
40ba9000-40de9000 rwxp 00000000 00:00 0 
41f10000-41fb0000 rwxp 00000000 00:00 0 
41fbd000-41fcd000 rwxp 00000000 00:00 0 
5581f8725000-5581f8b70000 r-xp 00000000 08:01 10224167                   /usr/bin/mono-sgen
5581f8d6f000-5581f8d76000 r--p 0044a000 08:01 10224167                   /usr/bin/mono-sgen
5581f8d76000-5581f8d7b000 rw-p 00451000 08:01 10224167                   /usr/bin/mono-sgen
5581f8d7b000-5581f8e0c000 rw-p 00000000 00:00 0 
5581f9030000-5581fa627000 rw-p 00000000 00:00 0                          [heap]
7f0b98000000-7f0b98021000 rw-p 00000000 00:00 0 
7f0b98021000-7f0b9c000000 ---p 00000000 00:00 0 
7f0b9c000000-7f0b9c047000 rw-p 00000000 00:00 0 
7f0b9c047000-7f0ba0000000 ---p 00000000 00:00 0 
7f0ba0000000-7f0ba0021000 rw-p 00000000 00:00 0 
7f0ba0021000-7f0ba4000000 ---p 00000000 00:00 0 
7f0ba4000000-7f0ba40a9000 rw-p 00000000 00:00 0 
7f0ba40a9000-7f0ba8000000 ---p 00000000 00:00 0 
7f0ba8000000-7f0ba8021000 rw-p 00000000 00:00 0 
7f0ba8021000-7f0bac000000 ---p 00000000 00:00 0 
7f0bac638000-7f0bac6b8000 rw-s 00000000 00:05 15630346                   /SYSV00000000 (deleted)
7f0bac6b8000-7f0bac6b9000 ---p 00000000 00:00 0 
7f0bac6b9000-7f0bac8b9000 rw-p 00000000 00:00 0 
7f0bac8b9000-7f0bac8ba000 ---p 00000000 00:00 0 
7f0bac8ba000-7f0bac8bb000 rw-p 00000000 00:00 0 
7f0bac8bb000-7f0bac8c3000 ---p 00000000 00:00 0 
7f0bac8c3000-7f0bacaba000 rw-p 00000000 00:00 0 
Memory around native instruction pointer (0x7f0bcbc70077):
0x7f0bcbc70067  d2 4c 89 ce bf 02 00 00 00 b8 0e 00 00 00 0f 05  .L..............
0x7f0bcbc70077  48 8b 8c 24 08 01 00 00 64 48 33 0c 25 28 00 00  H..$....dH3.%(..
0x7f0bcbc70087  00 44 89 c0 75 1f 48 81 c4 18 01 00 00 c3 0f 1f  .D..u.H.........
0x7f0bcbc70097  00 48 8b 15 d1 2d 1a 00 f7 d8 41 b8 ff ff ff ff  .H...-....A.....

Native stacktrace:

	/usr/bin/cli(+0x12a1bd) [0x5581f884f1bd]
	/usr/bin/cli(+0x12a4d5) [0x5581f884f4d5]
	/usr/bin/cli(+0xbfdbf) [0x5581f87e4dbf]
	/lib/x86_64-linux-gnu/libpthread.so.0(+0x12dd0) [0x7f0bcbe45dd0]
	/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7) [0x7f0bcbc70077]
	/lib/x86_64-linux-gnu/libc.so.6(abort+0x121) [0x7f0bcbc51535]
	/lib/x86_64-linux-gnu/libc.so.6(+0x2240f) [0x7f0bcbc5140f]
	/lib/x86_64-linux-gnu/libc.so.6(+0x32142) [0x7f0bcbc61142]
	/usr/lib/x86_64-linux-gnu/libX11.so.6(_XRead+0xf1) [0x7f0bc30f6361]
	/usr/lib/x86_64-linux-gnu/libX11.so.6(_XRead32+0x25) [0x7f0bc30f6e85]
	/usr/lib/x86_64-linux-gnu/libX11.so.6(XListFontsWithInfo+0x2af) [0x7f0bc30d88df]
	/usr/lib/x86_64-linux-gnu/libX11.so.6(+0x763a1) [0x7f0bc312e3a1]
	/usr/lib/x86_64-linux-gnu/libX11.so.6(XCreateOC+0xfc) [0x7f0bc30e4d7c]
	/usr/lib/x86_64-linux-gnu/libX11.so.6(XCreateFontSet+0x5d) [0x7f0bc30d937d]
	[0x40d3af22]
Pkilling 0x7f0bcbc2a780 from 0x7f0baccba700
Pkilling 0x7f0bc88e9700 from 0x7f0baccba700
Pkilling 0x7f0bc3908700 from 0x7f0baccba700
Pkilling 0x7f0bacebb700 from 0x7f0baccba700
Pkilling 0x7f0bacab9700 from 0x7f0baccba700
Pkilling 0x7f0bc3707700 from 0x7f0baccba700
Entering thread summarizer pause from 0x7f0baccba700
Finished thread summarizer pause from 0x7f0baccba700.

Waiting for dumping threads to resume


Debug info from gdb:

[New LWP 31772]
[New LWP 31773]
[New LWP 31775]
[New LWP 31776]
[New LWP 31777]
[New LWP 31784]
[New LWP 31785]
[New LWP 31854]
[New LWP 31856]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007f0bcbd3d6d9 in __GI___poll (fds=0x7ffff4f8aaa8, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
29	../sysdeps/unix/sysv/linux/poll.c: No such file or directory.
  Id   Target Id                                           Frame 
* 1    Thread 0x7f0bcbc2a780 (LWP 31770) "cli"             0x00007f0bcbd3d6d9 in __GI___poll (fds=0x7ffff4f8aaa8, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
  2    Thread 0x7f0bcb3ff700 (LWP 31772) "SGen worker"     futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x5581f8d8fb88) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
  3    Thread 0x7f0bc88e9700 (LWP 31773) "Finalizer"       futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=0, futex_word=0x5581f8d80d60) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
  4    Thread 0x7f0bc3707700 (LWP 31775) "Timer-Scheduler" futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x5581f9036968) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
  5    Thread 0x7f0bb89f7700 (LWP 31776) "gmain"           0x00007f0bcbd3d6d9 in __GI___poll (fds=0x5581f9edf4e0, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
  6    Thread 0x7f0baffff700 (LWP 31777) "gdbus"           0x00007f0bcbd3d6d9 in __GI___poll (fds=0x5581f9ea33a0, nfds=2, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
  7    Thread 0x7f0bacebb700 (LWP 31784) "Timer-Scheduler" futex_reltimed_wait_cancelable (private=<optimized out>, reltime=0x7f0bacebabc0, expected=0, futex_word=0x5581f8e0a7a8) at ../sysdeps/unix/sysv/linux/futex-internal.h:142
  8    Thread 0x7f0baccba700 (LWP 31785) "Thread Pool Wor" 0x00007f0bcbe457aa in __waitpid (pid=31861, stat_loc=0x7f0baccb76e4, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:30
  9    Thread 0x7f0bacab9700 (LWP 31854) "Thread Pool Wor" futex_abstimed_wait_cancelable (private=0, abstime=0x7f0bacab8d50, expected=0, futex_word=0x5581f8d81648) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
  10   Thread 0x7f0bac8b8700 (LWP 31856) "Thread Pool Wor" futex_abstimed_wait_cancelable (private=0, abstime=0x7f0bac8b7d50, expected=0, futex_word=0x5581f8d81648) at ../sysdeps/unix/sysv/linux/futex-internal.h:205

Thread 10 (Thread 0x7f0bac8b8700 (LWP 31856)):
#0  0x00007f0bcbe44142 in futex_abstimed_wait_cancelable (private=0, abstime=0x7f0bac8b7d50, expected=0, futex_word=0x5581f8d81648) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
#1  0x00007f0bcbe44142 in do_futex_wait (sem=sem@entry=0x5581f8d81648, abstime=abstime@entry=0x7f0bac8b7d50) at sem_waitcommon.c:111
#2  0x00007f0bcbe44253 in __new_sem_wait_slow (sem=0x5581f8d81648, abstime=0x7f0bac8b7d50) at sem_waitcommon.c:181
#3  0x00005581f89cbef5 in  ()
#4  0x00005581f896bbfb in  ()
#5  0x00007f0bcbe3b164 in start_thread (arg=<optimized out>) at pthread_create.c:486
#6  0x00007f0bcbd49def in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 9 (Thread 0x7f0bacab9700 (LWP 31854)):
#0  0x00007f0bcbe44142 in futex_abstimed_wait_cancelable (private=0, abstime=0x7f0bacab8d50, expected=0, futex_word=0x5581f8d81648) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
#1  0x00007f0bcbe44142 in do_futex_wait (sem=sem@entry=0x5581f8d81648, abstime=abstime@entry=0x7f0bacab8d50) at sem_waitcommon.c:111
#2  0x00007f0bcbe44253 in __new_sem_wait_slow (sem=0x5581f8d81648, abstime=0x7f0bacab8d50) at sem_waitcommon.c:181
#3  0x00005581f89cbef5 in  ()
#4  0x00005581f896bbfb in  ()
#5  0x00007f0bcbe3b164 in start_thread (arg=<optimized out>) at pthread_create.c:486
#6  0x00007f0bcbd49def in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 8 (Thread 0x7f0baccba700 (LWP 31785)):
#0  0x00007f0bcbe457aa in __waitpid (pid=31861, stat_loc=0x7f0baccb76e4, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:30
#1  0x00005581f884f2f7 in  ()
#2  0x00005581f884f4d5 in  ()
#3  0x00005581f87e4dbf in  ()
#4  0x00007f0bcbe45dd0 in <signal handler called> () at /lib/x86_64-linux-gnu/libpthread.so.0
#5  0x00007f0bcbc70077 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#6  0x00007f0bcbc51535 in __GI_abort () at abort.c:79
#7  0x00007f0bcbc5140f in __assert_fail_base (fmt=0x7f0bcbddd858 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x7f0bc3167a50 "!xcb_xlib_too_much_data_requested", file=0x7f0bc3167673 "../../src/xcb_io.c", line=742, function=<optimized out>) at assert.c:92
#8  0x00007f0bcbc61142 in __GI___assert_fail (assertion=0x7f0bc3167a50 "!xcb_xlib_too_much_data_requested", file=0x7f0bc3167673 "../../src/xcb_io.c", line=742, function=0x7f0bc3167a80 "_XRead") at assert.c:101
#9  0x00007f0bc30f6361 in _XRead () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#10 0x00007f0bc30f6e85 in _XRead32 () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#11 0x00007f0bc30d88df in XListFontsWithInfo () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#12 0x00007f0bc312e3a1 in  () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#13 0x00007f0bc30e4d7c in XCreateOC () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#14 0x00007f0bc30d937d in XCreateFontSet () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#15 0x0000000040d3af22 in  ()
#16 0x0000000000000000 in  ()

Thread 7 (Thread 0x7f0bacebb700 (LWP 31784)):
#0  0x00007f0bcbe41846 in futex_reltimed_wait_cancelable (private=<optimized out>, reltime=0x7f0bacebabc0, expected=0, futex_word=0x5581f8e0a7a8) at ../sysdeps/unix/sysv/linux/futex-internal.h:142
#1  0x00007f0bcbe41846 in __pthread_cond_wait_common (abstime=0x7f0bacebac60, mutex=0x5581f8e0a7c0, cond=0x5581f8e0a780) at pthread_cond_wait.c:533
#2  0x00007f0bcbe41846 in __pthread_cond_timedwait (cond=0x5581f8e0a780, mutex=0x5581f8e0a7c0, abstime=0x7f0bacebac60) at pthread_cond_wait.c:667
#3  0x00005581f8a2664b in  ()
#4  0x00005581f8a30f00 in  ()
#5  0x00005581f89cb642 in  ()
#6  0x00005581f896bbfb in  ()
#7  0x00007f0bcbe3b164 in start_thread (arg=<optimized out>) at pthread_create.c:486
#8  0x00007f0bcbd49def in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 6 (Thread 0x7f0baffff700 (LWP 31777)):
#0  0x00007f0bcbd3d6d9 in __GI___poll (fds=0x5581f9ea33a0, nfds=2, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f0bc2760e46 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f0bc27611d2 in g_main_loop_run () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f0bbbd257b6 in  () at /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#4  0x00007f0bc2789135 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007f0bcbe3b164 in start_thread (arg=<optimized out>) at pthread_create.c:486
#6  0x00007f0bcbd49def in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 5 (Thread 0x7f0bb89f7700 (LWP 31776)):
#0  0x00007f0bcbd3d6d9 in __GI___poll (fds=0x5581f9edf4e0, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f0bc2760e46 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f0bc2760f6c in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f0bc2760fb1 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007f0bc2789135 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007f0bcbe3b164 in start_thread (arg=<optimized out>) at pthread_create.c:486
#6  0x00007f0bcbd49def in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 4 (Thread 0x7f0bc3707700 (LWP 31775)):
#0  0x00007f0bcbe412eb in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x5581f9036968) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  0x00007f0bcbe412eb in __pthread_cond_wait_common (abstime=0x0, mutex=0x5581f9036918, cond=0x5581f9036940) at pthread_cond_wait.c:502
#2  0x00007f0bcbe412eb in __pthread_cond_wait (cond=0x5581f9036940, mutex=0x5581f9036918) at pthread_cond_wait.c:655
#3  0x00005581f8a266ad in  ()
#4  0x00005581f8981d3c in  ()
#5  0x00005581f898312f in  ()
#6  0x00005581f89836e0 in  ()
#7  0x00005581f89690d2 in  ()
#8  0x0000000040bf7e8d in  ()
#9  0x0000000000000000 in  ()

Thread 3 (Thread 0x7f0bc88e9700 (LWP 31773)):
#0  0x00007f0bcbe43f56 in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=0, futex_word=0x5581f8d80d60) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
#1  0x00007f0bcbe43f56 in do_futex_wait (sem=sem@entry=0x5581f8d80d60, abstime=0x0) at sem_waitcommon.c:111
#2  0x00007f0bcbe44048 in __new_sem_wait_slow (sem=0x5581f8d80d60, abstime=0x0) at sem_waitcommon.c:181
#3  0x00005581f89b61f8 in  ()
#4  0x00005581f896bbfb in  ()
#5  0x00007f0bcbe3b164 in start_thread (arg=<optimized out>) at pthread_create.c:486
#6  0x00007f0bcbd49def in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 2 (Thread 0x7f0bcb3ff700 (LWP 31772)):
#0  0x00007f0bcbe412eb in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x5581f8d8fb88) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  0x00007f0bcbe412eb in __pthread_cond_wait_common (abstime=0x0, mutex=0x5581f8d8fba0, cond=0x5581f8d8fb60) at pthread_cond_wait.c:502
#2  0x00007f0bcbe412eb in __pthread_cond_wait (cond=0x5581f8d8fb60, mutex=0x5581f8d8fba0) at pthread_cond_wait.c:655
#3  0x00005581f8a1739a in  ()
#4  0x00007f0bcbe3b164 in start_thread (arg=<optimized out>) at pthread_create.c:486
#5  0x00007f0bcbd49def in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 1 (Thread 0x7f0bcbc2a780 (LWP 31770)):
#0  0x00007f0bcbd3d6d9 in __GI___poll (fds=0x7ffff4f8aaa8, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f0bc3f1a917 in  () at /usr/lib/x86_64-linux-gnu/libxcb.so.1
#2  0x00007f0bc3f1c25f in  () at /usr/lib/x86_64-linux-gnu/libxcb.so.1
#3  0x00007f0bc3f1c3d1 in xcb_wait_for_reply64 () at /usr/lib/x86_64-linux-gnu/libxcb.so.1
#4  0x00007f0bc30f5e38 in _XReply () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#5  0x00007f0bc30da94e in XGetGeometry () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#6  0x00007f0bc284990a in GdipCreateFromXDrawable_linux () at /usr/lib/libgdiplus.so.0
#7  0x0000000040c3f0fb in  ()
#8  0x00005581f99d2d78 in  ()
#9  0x00007f0bc067f1b0 in  ()
#10 0x00007ffff4f8b278 in  ()
#11 0x00007f0bcb73bd00 in  ()
#12 0x0000000006e00470 in  ()
#13 0x00005581f906ea80 in  ()
#14 0x00007ffff4f8b0a0 in  ()
#15 0x00007ffff4f8adf0 in  ()
#16 0x00007ffff4f8af00 in  ()
#17 0x0000000040c3f038 in  ()
#18 0x0000000000000000 in  ()
[Inferior 1 (process 31770) detached]

=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Aborted (core dumped)

@DasSkelett
Copy link
Member Author

Hmm, I cannot recreate this crash.
Your exact steps are

  1. Open clone/fake dialog
  2. Click OK without doing anything else
  3. Error dialog shows up, click Dismiss
  4. Fill in name and path for the new instance (But DON'T change the text of the clone source textbox)
  5. Click OK again
  6. Get hard crash?
    Is this right?

@HebaruSan
Copy link
Member

Yes, that's what I remember doing. ... Confirmed with another attempt, I just repeated it.
If it's not consistent for you, then that sounds like a race condition.

@DasSkelett
Copy link
Member Author

I redid the task code a bit:
Now there's less executed in the tasks, more outside; exceptions are catched outside the tasks.
@HebaruSan can you check if this already fixed your problem?

@HebaruSan
Copy link
Member

Looks better, now I get an explanatory error:

image

However then the window changes to a weird size with a bunch of the controls truncated:

image

Haven't looked at the code yet but maybe there's a progress bar mode that's not being exited cleanly?

@DasSkelett
Copy link
Member Author

It was a mono window size problem again...
Our current ApplyCompatibilityFixes() does not work for every window size it seems.
Took me some time to find the right values.

@HebaruSan
Copy link
Member

Created DasSkelett#2 with my UI suggestions.

@politas
Copy link
Member

politas commented Jan 26, 2019

If we're adding all this functionality, we should rename the "Select KSP Instance" dialog and menu item to "Manage KSP Instances"

@politas
Copy link
Member

politas commented Feb 2, 2019

image
Couple of issues here -

  1. It's not working
  2. The Dialog box title is still "Select KSP Install" though the menu option that launches is is "Manage KSP Instances"

I note that it somehow didn't get the right destination folder, so:
image

This may be due to /home/politas/Desktop/KSP/KSP-Steam being a symlink.

@DasSkelett
Copy link
Member Author

DasSkelett commented Feb 2, 2019

I see that the error message is also wrong, IOException is not the right one to throw for invalid destination paths. I think I'll create a new Kraken for that.

For your first issue: CopyDirectory() tries to copy the .git folder, but somehow can't find it.

This makes me think if it even makes sense to copy hidden files and folders too when cloning KSP instances. Probably not, but I would like to hear your opinions first before I change CopyDirectory().

@politas
Copy link
Member

politas commented Feb 3, 2019

Not sure what the deal was with that .git directory. It may have been an invalid link thanks to having moved the Steam library to a different hard disk.

$ git status
fatal: not a git repository (or any parent up to mount point /mnt)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

When I delete the useless .git* directory entries, cloning works on that instance, too. So the only issue there is the error message in the second screenshot.

@DasSkelett
Copy link
Member Author

DasSkelett commented Feb 5, 2019

Oups, forgot the new Kraken. Hang on...

Edit: Actually, we have a PathErrorKraken which already has a path field, too. I think it makes sense to use this one to replace the manually thrown IOException, instead of a new one.

@politas politas merged commit e59b211 into KSP-CKAN:master Feb 8, 2019
politas added a commit that referenced this pull request Feb 8, 2019
DasSkelett added a commit to DasSkelett/CKAN that referenced this pull request Feb 11, 2019
PR KSP-CKAN#2665 changed the IOException to PathErrorKraken in `CopyDirectory()`.
Now the new tests for `CopyDirectory()` assert the new kraken.
@DasSkelett DasSkelett deleted the feature/clone-fake-GUI branch February 18, 2019 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New features or functionality GUI Issues affecting the interactive GUI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants