Query GdkWindow reference only if available

On startup, the Geany main window doesn't have a GdkWindow yet
(probably because it is not yet mapped). This causes many
'gdkdrawable-win32.c:2013 drawable is not a pixmap or window'
warnings when resolving shortcuts on Windows.
Since we pass the SLR_NO_UI to the Windows API, we probably
don't need the parent hWnd reference at all.
This commit is contained in:
Enrico Tröger 2014-10-12 16:35:46 +02:00
parent 75ab7103f1
commit 3966ba8c4b

View File

@ -1474,8 +1474,16 @@ gchar *win32_get_shortcut_target(const gchar *file_name)
{
gchar *path = NULL;
wchar_t *wfilename = g_utf8_to_utf16(file_name, -1, NULL, NULL, NULL);
resolve_link(GDK_WINDOW_HWND(gtk_widget_get_window(main_widgets.window)), wfilename, &path);
HWND hWnd = NULL;
if (main_widgets.window != NULL)
{
GdkWindow *window = gtk_widget_get_window(main_widgets.window);
if (window != NULL)
hWnd = GDK_WINDOW_HWND(window);
}
resolve_link(hWnd, wfilename, &path);
g_free(wfilename);
if (path == NULL)