Don't overwrite variables stored in file_monitor (Closes: #120)

This commit is contained in:
Sebastian Ramacher 2012-03-02 20:34:41 +01:00
parent 2a0422b5e1
commit 557f968875

View File

@ -418,24 +418,30 @@ document_open(zathura_t* zathura, const char* path, const char* password)
goto error_free; goto error_free;
} }
zathura->file_monitor.file = g_file_new_for_uri(file_uri);
if (zathura->file_monitor.file == NULL) { if (zathura->file_monitor.file == NULL) {
goto error_free; zathura->file_monitor.file = g_file_new_for_uri(file_uri);
if (zathura->file_monitor.file == NULL) {
goto error_free;
}
} }
zathura->file_monitor.monitor = g_file_monitor_file(zathura->file_monitor.file, G_FILE_MONITOR_NONE, NULL, NULL);
if (zathura->file_monitor.monitor == NULL) { if (zathura->file_monitor.monitor == NULL) {
goto error_free; zathura->file_monitor.monitor = g_file_monitor_file(zathura->file_monitor.file, G_FILE_MONITOR_NONE, NULL, NULL);
if (zathura->file_monitor.monitor == NULL) {
goto error_free;
}
g_signal_connect(G_OBJECT(zathura->file_monitor.monitor), "changed", G_CALLBACK(cb_file_monitor), zathura->ui.session);
} }
g_signal_connect(G_OBJECT(zathura->file_monitor.monitor), "changed", G_CALLBACK(cb_file_monitor), zathura->ui.session);
zathura->file_monitor.file_path = g_strdup(document->file_path);
if (zathura->file_monitor.file_path == NULL) { if (zathura->file_monitor.file_path == NULL) {
goto error_free; zathura->file_monitor.file_path = g_strdup(document->file_path);
if (zathura->file_monitor.file_path == NULL) {
goto error_free;
}
} }
if (document->password != NULL) { if (document->password != NULL) {
g_free(zathura->file_monitor.password);
zathura->file_monitor.password = g_strdup(document->password); zathura->file_monitor.password = g_strdup(document->password);
if (zathura->file_monitor.password == NULL) { if (zathura->file_monitor.password == NULL) {
goto error_free; goto error_free;